Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 KB | None | 0 0
  1. using System;
  2.  
  3. class BabaTincheAirlines
  4. {
  5.     static void Main()
  6.     {
  7.         string firstClass = Console.ReadLine();
  8.         string businessClass = Console.ReadLine();
  9.         string economyClass = Console.ReadLine();
  10.  
  11.         string[] firstParameters = firstClass.Split();
  12.         int firstClassPassengers = int.Parse(firstParameters[0]);
  13.         int firstFrequentFlyers = int.Parse(firstParameters[1]);
  14.         int firstMealBuyers = int.Parse(firstParameters[2]);
  15.  
  16.         string[] businessParameters = businessClass.Split();
  17.         int businessPassengers = int.Parse(businessParameters[0]);
  18.         int businessFrequentFlyers = int.Parse(businessParameters[1]);
  19.         int businessMealBuyers = int.Parse(businessParameters[2]);
  20.  
  21.         string[] economyParameters = economyClass.Split();
  22.         int economyPassengers = int.Parse(economyParameters[0]);
  23.         int economyFrequentFlyers = int.Parse(economyParameters[1]);
  24.         int economyMealBuyers = int.Parse(economyParameters[2]);
  25.  
  26.         int normalFirstClassPassengers = firstClassPassengers - firstFrequentFlyers - firstMealBuyers;
  27.  
  28.         double firstClassIncome = (normalFirstClassPassengers * 7000) + (firstFrequentFlyers * 2100) +
  29.             firstMealBuyers * 7035;
  30.  
  31.         int normalBusinessClassPassengers = businessPassengers - businessFrequentFlyers - businessMealBuyers;
  32.  
  33.         double businessClassIncome = (normalBusinessClassPassengers * 3500) + (businessFrequentFlyers * 1050) +
  34.             businessMealBuyers * 3517.5;
  35.  
  36.         int normalEconomyBuyers = economyPassengers - economyFrequentFlyers - economyMealBuyers;
  37.  
  38.         double economyIncome = (normalEconomyBuyers * 1000) + (economyFrequentFlyers * 300) +
  39.             (economyMealBuyers * 1005);
  40.  
  41.         int totalIncome = (int)(firstClassIncome + businessClassIncome + economyIncome);
  42.         double maxIncome =  (12 * 7035) + (28 * 3517.5) + (50 * 1005);
  43.         int difference = (int)(maxIncome - totalIncome);
  44.  
  45.         Console.WriteLine(totalIncome);
  46.         Console.WriteLine(difference);
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement