Advertisement
poli_rk

Untitled

Sep 22nd, 2020
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ToyShop
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double travelPrice = double.Parse(Console.ReadLine());
  10. int soldPuzzles = int.Parse(Console.ReadLine());
  11. int soldDolls = int.Parse(Console.ReadLine());
  12. int soldTeddyBears = int.Parse(Console.ReadLine());
  13. int soldMinions = int.Parse(Console.ReadLine());
  14. int soldTrucks = int.Parse(Console.ReadLine());
  15.  
  16. double puzzlesMoney = soldPuzzles * 2.6;
  17. double dollsMoney = soldDolls * 3;
  18. double teddyBearsMoney = soldTeddyBears * 4.1;
  19. double minionsMoney = soldMinions * 8.2;
  20. double trucksMoney = soldTrucks * 2;
  21.  
  22. int toysCount = soldPuzzles + soldDolls + soldTeddyBears + soldMinions + soldTrucks;
  23. double totalProfit = puzzlesMoney + dollsMoney + teddyBearsMoney + minionsMoney + trucksMoney;
  24.  
  25. if (toysCount >= 50)
  26. {
  27. totalProfit = totalProfit * 0.75;
  28. }
  29.  
  30. totalProfit = totalProfit * 0.9;
  31.  
  32. if (totalProfit >= travelPrice)
  33. {
  34. double remainingMoney = totalProfit - travelPrice;
  35. Console.WriteLine($"Yes! { remainingMoney:F2} lv left.");
  36. }
  37.  
  38. else if (totalProfit < travelPrice)
  39. {
  40. double missingMoney = travelPrice - totalProfit;
  41. Console.WriteLine($"Not enough money! {missingMoney:F2} lv needed.");
  42. }
  43.  
  44.  
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement