Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Shopping
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double budget = double.Parse(Console.ReadLine());
  14. int chocolates = int.Parse(Console.ReadLine());
  15. double milk = double.Parse(Console.ReadLine());
  16.  
  17. double chocolatesPrice = chocolates * 0.65;
  18. double milkPrice = milk * 2.70;
  19. double mandarinesPrice = (Math.Floor(chocolates - (chocolates * 0.35)) * 0.20);
  20.  
  21. double totalCost = chocolatesPrice + milkPrice + mandarinesPrice;
  22.  
  23. if (budget >= totalCost)
  24. {
  25. Console.WriteLine($"You got this, {budget - totalCost:f2} money left!");
  26. }
  27. else
  28. {
  29. Console.WriteLine($"Not enough money, you need {totalCost-budget:F2} more!");
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement