iliya87

01.BabaTincheAirlines

Mar 25th, 2015
260
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.  
  3. class BabaTincheAirlines
  4. {
  5.     static void Main()
  6.     {
  7.         string[] firstInput = Console.ReadLine().Split();
  8.         string[] secondInput = Console.ReadLine().Split();
  9.         string[] thirdInput = Console.ReadLine().Split();
  10.  
  11.         // Calculating the income from First Class passengers
  12.         int firstClassIncome = (Convert.ToInt32(firstInput[0]) - Convert.ToInt32(firstInput[1])) * 7000;
  13.         firstClassIncome += (int)(Convert.ToInt32(firstInput[1]) * (7000 * 0.3));
  14.         firstClassIncome += (int)(Convert.ToInt32(firstInput[2]) * (0.005 * 7000));
  15.  
  16.         // Calculating the income from Business Class passengers
  17.         int secondClassIncome = (Convert.ToInt32(secondInput[0]) - Convert.ToInt32(secondInput[1])) * 3500;
  18.         secondClassIncome += (int)(Convert.ToInt32(secondInput[1]) * (3500 * 0.3));
  19.         secondClassIncome += (int)(Convert.ToInt32(secondInput[2]) * (0.005 * 3500));
  20.  
  21.         // Calculating the income from Economy Class passengers
  22.         int thirdClassIncome = (Convert.ToInt32(thirdInput[0]) - Convert.ToInt32(thirdInput[1])) * 1000;
  23.         thirdClassIncome += (int)(Convert.ToInt32(thirdInput[1]) * (1000 * 0.3));
  24.         thirdClassIncome += (int)(Convert.ToInt32(thirdInput[2]) * (0.005 * 1000));
  25.  
  26.         // Calculating the total income
  27.         int totalIncome = firstClassIncome + secondClassIncome + thirdClassIncome;
  28.  
  29.         // Calculate the maximum possible income
  30.         int maxIncome = (int)(12 * 7000 + 12 * (0.005 * 7000)) + (int)(28 * 3500 + 28 * (0.005 * 3500)) + (int)(50 * 1000 + 50 * (0.005 * 1000));
  31.  
  32.         Console.WriteLine(totalIncome);
  33.         Console.WriteLine(maxIncome - totalIncome);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment