Advertisement
Guest User

Untitled

a guest
Sep 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. double tripPrice = double.Parse(Console.ReadLine());
  8. int puzzleAmount = int.Parse(Console.ReadLine());
  9. int dollsAmount = int.Parse(Console.ReadLine());
  10. int teddybearsAmount = int.Parse(Console.ReadLine());
  11. int minionsAmount = int.Parse(Console.ReadLine());
  12. int trucksAmount = int.Parse(Console.ReadLine());
  13.  
  14. double puzzlePrice = 2.60;
  15. double dollPrice = 3;
  16. double teddybearPrice = 4.10;
  17. double minionPrice = 8.20;
  18. double truckPrice = 2;
  19. double rent = 0.0;
  20. double moneyWon = 0.0;
  21.  
  22. double sumPrice = puzzleAmount * puzzlePrice + dollsAmount * dollPrice + teddybearsAmount * teddybearPrice + minionsAmount * minionPrice + trucksAmount * truckPrice;
  23. int countToys = puzzleAmount + dollsAmount + teddybearsAmount + minionsAmount + trucksAmount;
  24.  
  25. if (countToys >= 50)
  26. {
  27. double discount = 0.25 * sumPrice;
  28. double finalDiscountPrice = sumPrice - discount;
  29. rent = 0.1 * finalDiscountPrice;
  30. moneyWon = finalDiscountPrice - rent;
  31. }
  32. else if (countToys < 50)
  33. {
  34. rent = 0.1 * sumPrice;
  35. moneyWon = sumPrice - rent;
  36.  
  37. }
  38. if (moneyWon >= tripPrice)
  39. {
  40. Console.WriteLine("Yes! {0:0.00} lv left.", moneyWon-tripPrice);
  41. }
  42. else if (moneyWon < tripPrice)
  43. {
  44. Console.WriteLine("Not enough money! {0:0.00} lv needed.", tripPrice-moneyWon);
  45. }
  46.  
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement