Advertisement
nivanov93

SoftUni Airline

Jun 10th, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics.Eventing.Reader;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. class Program
  9. {
  10.     static void Main(string[] args)
  11.     {
  12.         int numberOfFly = int.Parse(Console.ReadLine());
  13.  
  14.         int adultPas = int.Parse(Console.ReadLine());
  15.         decimal adultTicketPrice = decimal.Parse(Console.ReadLine());
  16.         int youngPas = int.Parse(Console.ReadLine());
  17.         decimal youngTicketPrice = decimal.Parse(Console.ReadLine());
  18.         decimal fuelPricePerHour = decimal.Parse(Console.ReadLine());
  19.         double fuelLess = double.Parse(Console.ReadLine());
  20.         double duration = double.Parse(Console.ReadLine());
  21.  
  22.         decimal myIncome = ((adultPas*adultTicketPrice) + (youngPas*youngTicketPrice));
  23.         decimal expenses = (fuelPricePerHour*(decimal) (fuelLess*duration));
  24.  
  25.         decimal profit = (decimal) (myIncome - expenses);
  26.  
  27.  
  28.         if (myIncome >= expenses)
  29.         {
  30.             Console.WriteLine($"You are ahead with {profit:f3}$.");
  31.         }
  32.         else
  33.         {
  34.             Console.WriteLine($"We've got to sell more tickets! We've lost {profit:f3}$.");
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement