Advertisement
nevenailievaa

04.ToyShop

Nov 10th, 2024
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. //Input
  2. double excursionPrice = double.Parse(Console.ReadLine());
  3. int puzzlesCount = int.Parse(Console.ReadLine());
  4. int dollsCount = int.Parse(Console.ReadLine());
  5. int bearsCount = int.Parse(Console.ReadLine());
  6. int minionsCount = int.Parse(Console.ReadLine());
  7. int trucksCount = int.Parse(Console.ReadLine());
  8.  
  9. //Prices
  10. double puzzlePrice = 2.60;
  11. double dollPrice = 3.00;
  12. double bearPrice = 4.10;
  13. double minionPrice = 8.20;
  14. double truckPrice = 2.00;
  15.  
  16. //Calculations
  17. double toysBill = (puzzlesCount * puzzlePrice) + (dollsCount * dollPrice) + (bearsCount * bearPrice) + (minionsCount * minionPrice) + (trucksCount * truckPrice);
  18.  
  19. int toysCount = puzzlesCount + dollsCount + bearsCount + minionsCount + trucksCount;
  20.  
  21. if (toysCount >= 50)
  22. {
  23.     toysBill = toysBill * 0.75;
  24. }
  25.  
  26. double shopRent = toysBill * 0.1;
  27. toysBill = toysBill - shopRent;
  28.  
  29. //Output
  30. if (toysBill >= excursionPrice)
  31. {
  32.     double remainingMoney = toysBill - excursionPrice;
  33.     Console.WriteLine($"Yes! {remainingMoney:f2} lv left.");
  34. }
  35. else
  36. {
  37.     double neededMoney = excursionPrice - toysBill;
  38.     Console.WriteLine($"Not enough money! {neededMoney:f2} lv needed.");
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement