Advertisement
kalin729

трета

Dec 17th, 2017 (edited)
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.30 KB | None | 0 0
  1.  var car_model = Console.ReadLine();
  2.             var car_type = Console.ReadLine();
  3.             var season = Console.ReadLine();
  4.             var condition = Console.ReadLine();
  5.             var price = double.Parse(Console.ReadLine());
  6.             var exp_profit = double.Parse(Console.ReadLine());
  7.             double profit = 0;
  8.  
  9.             if (string.Equals(condition, "perfect", StringComparison.CurrentCultureIgnoreCase))
  10.             {
  11.                 if (string.Equals(car_type, "SUV", StringComparison.CurrentCultureIgnoreCase))
  12.                 {
  13.                     profit = price * (0.3);
  14.                 }
  15.                 else if (string.Equals(car_type, "Sedan", StringComparison.CurrentCultureIgnoreCase))
  16.                 {
  17.                     profit = price * (0.25);
  18.                 }
  19.             }
  20.             else if (string.Equals(condition, "good", StringComparison.CurrentCultureIgnoreCase))
  21.             {
  22.                 if (string.Equals(car_type, "SUV", StringComparison.CurrentCultureIgnoreCase))
  23.                 {
  24.                     profit = price * (0.2);
  25.                 }
  26.                 else if (string.Equals(car_type, "Sedan", StringComparison.CurrentCultureIgnoreCase))
  27.                 {
  28.                     profit = price * (0.15);
  29.                 }
  30.             }
  31.             else if (string.Equals(condition, "bad", StringComparison.CurrentCultureIgnoreCase)) {
  32.                 if (string.Equals(car_type, "SUV", StringComparison.CurrentCultureIgnoreCase))
  33.                 {
  34.                     profit = price * (0.1);
  35.                 }
  36.                 else if (string.Equals(car_type, "Sedan", StringComparison.CurrentCultureIgnoreCase))
  37.                 {
  38.                     profit = price * (0.1);
  39.                 }
  40.             }
  41.  
  42.             if (string.Equals(season, "winter", StringComparison.CurrentCultureIgnoreCase)) {
  43.                 profit = profit - 200;
  44.             }
  45.  
  46.             if (profit > exp_profit)
  47.             {
  48.                 Console.WriteLine("The profit on {0} will be good – {1} BGN", car_model, profit);
  49.             }
  50.             else {
  51.                 double need = exp_profit - profit;
  52.                 Console.WriteLine("The car is not worth selling now");
  53.                 Console.WriteLine("Need {0} more profit", need);
  54.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement