Вопрос задан 04.09.2020 в 17:00. Предмет Информатика. Спрашивает Макаров Ньургун.

Составьте программу для определения суммы денег, получаемой авиакомпанией от продажи билетов на

рейс из Лондона в Нью-Йорк, если в самолёте три четверти пассажиров имеют билеты первого класса, стоимостью и X рублей за каждый. Остальные пассажиры имеют билеты второго класса, которые дешевле билетов первого класса на 20%. Количество пассажиров и стоимость билетов первого класса вводятся с клавиатуры.
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Program to Determine the Total Revenue from Ticket Sales for an Airline

To calculate the total revenue from ticket sales for an airline, we need to consider the number of passengers and the cost of tickets for each class. Let's assume that the number of passengers and the cost of first-class tickets are provided by the user as input.

Here's a program in Python that calculates the total revenue:

```python # Get the number of passengers and the cost of first-class tickets from the user num_passengers = int(input("Enter the number of passengers: ")) ticket_cost_first_class = float(input("Enter the cost of first-class tickets: "))

# Calculate the cost of second-class tickets (20% cheaper than first-class tickets) ticket_cost_second_class = ticket_cost_first_class * 0.8

# Calculate the total revenue revenue_first_class = num_passengers * (3/4) * ticket_cost_first_class revenue_second_class = num_passengers * (1/4) * ticket_cost_second_class total_revenue = revenue_first_class + revenue_second_class

# Print the total revenue print("The total revenue from ticket sales is:", total_revenue) ```

In this program, we first prompt the user to enter the number of passengers and the cost of first-class tickets. We then calculate the cost of second-class tickets, which are 20% cheaper than first-class tickets. Next, we calculate the revenue from first-class tickets by multiplying the number of passengers (three-fourths of the total) by the cost of first-class tickets. Similarly, we calculate the revenue from second-class tickets by multiplying the number of passengers (one-fourth of the total) by the cost of second-class tickets. Finally, we add the revenues from both classes to get the total revenue and print it.

Please note that this program assumes that the number of passengers is a positive integer and the cost of first-class tickets is a positive float. It does not handle any error cases or input validation.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос