fbinnzhivko

01.01 Babe Tinche Airlines

Mar 17th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.67 KB | None | 0 0
  1. using System;
  2. class BabaTincheAirlines
  3. {
  4.     static void Main()
  5.     {
  6.         string[] firstInput = Console.ReadLine().Split();
  7.         string[] secondInput = Console.ReadLine().Split();
  8.         string[] thirdInput = Console.ReadLine().Split();
  9.  
  10.         // Calculating the income from First Class passengers
  11.         int firstClassIncome = (Convert.ToInt32(firstInput[0]) - Convert.ToInt32(firstInput[1])) * 7000;
  12.         firstClassIncome += (int)(Convert.ToInt32(firstInput[1]) * (7000 * 0.3));
  13.         firstClassIncome += (int)(Convert.ToInt32(firstInput[2]) * (0.005 * 7000));
  14.  
  15.         // Calculating the income from Business Class passengers
  16.         int secondClassIncome = (Convert.ToInt32(secondInput[0]) - Convert.ToInt32(secondInput[1])) * 3500;
  17.         secondClassIncome += (int)(Convert.ToInt32(secondInput[1]) * (3500 * 0.3));
  18.         secondClassIncome += (int)(Convert.ToInt32(secondInput[2]) * (0.005 * 3500));
  19.  
  20.         // Calculating the income from Economy Class passengers
  21.         int thirdClassIncome = (Convert.ToInt32(thirdInput[0]) - Convert.ToInt32(thirdInput[1])) * 1000;
  22.         thirdClassIncome += (int)(Convert.ToInt32(thirdInput[1]) * (1000 * 0.3));
  23.         thirdClassIncome += (int)(Convert.ToInt32(thirdInput[2]) * (0.005 * 1000));
  24.  
  25.         // Calculating the total income
  26.         int totalIncome = firstClassIncome + secondClassIncome + thirdClassIncome;
  27.  
  28.         // Calculate the maximum possible income
  29.         int maxIncome = (int)(12 * 7000 + 12 * (0.005 * 7000)) + (int)(28 * 3500 + 28 * (0.005 * 3500)) + (int)(50 * 1000 + 50 * (0.005 * 1000));
  30.  
  31.         Console.WriteLine(totalIncome);
  32.         Console.WriteLine(maxIncome - totalIncome);
  33.     }
  34. }
Add Comment
Please, Sign In to add comment