Advertisement
mustafov

Baba Tinche Airlines

Sep 3rd, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.87 KB | None | 0 0
  1. //Baba Tinche Airlines
  2. //Every month Baba Tinche travels to the Republic of Tajikistan to meet her boyfriend. But the tickets are so expensive that she //decides to establish her own airline instead called Baba Tinche Airlines. There are three travel classes in Baba Tinche Airlines:
  3. //•   First Class which accommodates 12 passengers. The ticket price is $7000.
  4. //•   Business Class which accommodates 28 passengers. The ticket price is $3500.
  5. //•   Economy Class which accommodates 50 passengers. The ticket price is $1000.
  6. //Please note that some passengers are Frequent Flyers and their tickets are 70% off ($1000 ticket will cost $300). Also some //passengers purchase a meal on the flight, which costs 0.5% of the ticket price for the travel class they are in. Please help //Baba //Tinche calculate her income and calculate the difference between her income and the maximum possible income (the maximum //possible //income being all seats taken, no Frequent Flyers and everyone purchasing meals). You will be given the number of //passengers for //each class, the number of passengers who are Frequent Flyers in that class, and the number of passengers who //purchase a meal in //that class.
  7.  
  8.  
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14.  
  15. namespace ConsoleApplication3
  16. {
  17.     class Program
  18.     {
  19.         static void Main(string[] args)
  20.         {
  21.             string input1 = Console.ReadLine();
  22.             string[] line1 = input1.Split(' ');
  23.             int firstClass = Convert.ToInt32(line1[0]);
  24.             int FiCnumOfFF = Convert.ToInt32(line1[1]);
  25.             int FCMeal = Convert.ToInt32(line1[2]);
  26.             int cost1 = ((firstClass - FiCnumOfFF) * 7000) + (FiCnumOfFF * 2100) + (FCMeal * 35);
  27.             int maxCost1 = (12 * 7000) + (12 * 35);
  28.  
  29.             string input2 = Console.ReadLine();
  30.             string[] line2 = input2.Split(' ');
  31.             int bussinessClass = Convert.ToInt32(line2[0]);
  32.             int BussCnumOfFF = Convert.ToInt32(line2[1]);
  33.             int BussCMeal = Convert.ToInt32(line2[2]);
  34.             int cost2 = ((bussinessClass - BussCnumOfFF) * 3500) + (BussCnumOfFF * 1050) + (BussCMeal * 35/2);
  35.             int maxCost2 = (28 * 3500) + (28 * 35/2);
  36.  
  37.             string input3 = Console.ReadLine();
  38.             string[] line3 = input3.Split(' ');
  39.             int economyClass = Convert.ToInt32(line3[0]);
  40.             int EcClnumOfFF = Convert.ToInt32(line3[1]);
  41.             int EcClMeal = Convert.ToInt32(line3[2]);
  42.             int cost3 = ((economyClass - EcClnumOfFF) * 1000) + (EcClnumOfFF * 300) + (EcClMeal * 5);
  43.             int maxCost3 = (50 * 1000) + (50 * 5);
  44.  
  45.             int sum = cost1 + cost2 + cost3;
  46.             int maxSum = maxCost1 + maxCost2 + maxCost3;
  47.  
  48.             Console.WriteLine(sum);
  49.             Console.WriteLine(maxSum - sum);
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement