StoimenK

C# Toy Shop

Sep 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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 vacation = double.Parse(Console.ReadLine());
  10. int puzzles = int.Parse(Console.ReadLine());
  11. int dolls = int.Parse(Console.ReadLine());
  12. int bears = int.Parse(Console.ReadLine());
  13. int minions = int.Parse(Console.ReadLine());
  14. int trucks = int.Parse(Console.ReadLine());
  15.  
  16. double sum = puzzles * 2.60 + dolls * 3 + bears * 4.10 + minions * 8.20 + trucks * 2;
  17. int toyNumber = puzzles + dolls + bears + minions + trucks;
  18.  
  19. double discount = 0.0;
  20. if (toyNumber >= 50)
  21. {
  22. discount = sum * 0.25;
  23. }
  24.  
  25. double endPrice = sum - discount;
  26. endPrice = endPrice - (endPrice * 0.10);
  27.  
  28. if ( endPrice > vacation)
  29. {
  30. endPrice = endPrice - vacation;
  31. Console.WriteLine($"Yes! {endPrice:F2} lv left.");
  32. }
  33.  
  34. else if (endPrice < vacation)
  35. {
  36. endPrice = vacation - endPrice;
  37. Console.WriteLine($"Not enough money! {endPrice:F2} lv needed.");
  38. }
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment