miglenabs

Untitled

Nov 11th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Shopping
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double budget = double.Parse(Console.ReadLine());
  10. int videoCardQuantity = int.Parse(Console.ReadLine());
  11. int processorsQuantity = int.Parse(Console.ReadLine());
  12. int ramQuantity = int.Parse(Console.ReadLine());
  13.  
  14. double videoCardPrice = videoCardQuantity * 250;
  15. double processorsPrice = videoCardPrice* 0.35;
  16. double ramPrice = videoCardPrice* 0.10;
  17.  
  18. double totalPrice = videoCardPrice + processorsPrice + ramPrice;
  19.  
  20. if (videoCardQuantity > processorsQuantity)
  21. {
  22. totalPrice = totalPrice - (totalPrice * 0.15);
  23. }
  24.  
  25.  
  26. if (totalPrice <=budget)
  27. {
  28. Console.WriteLine($"You have {(budget-totalPrice):f2} leva left!");
  29. }
  30.  
  31. else if (totalPrice> budget)
  32. {
  33. Console.WriteLine($"Not enough money! You need {(totalPrice-budget):f2} leva more!");
  34. }
  35.  
  36.  
  37. }
  38. }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment