Advertisement
ss3434

Untitled

Jan 22nd, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _9._Padawan_Equipment
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double amountOfMoney = double.Parse(Console.ReadLine());
  10. int numberOfStudents = int.Parse(Console.ReadLine());
  11. double priceSaber = double.Parse(Console.ReadLine());
  12. double priceRobes= double.Parse(Console.ReadLine());
  13. double priceBelt = double.Parse(Console.ReadLine());
  14.  
  15.  
  16. double sumSaber = (Math.Ceiling(numberOfStudents + numberOfStudents * 0.10)) * priceSaber;
  17. double sumRobes = numberOfStudents * priceRobes;
  18. double freeBelts = 0;
  19. if (numberOfStudents>=6)
  20. {
  21. freeBelts = numberOfStudents / 6;
  22. }
  23.  
  24. double sumBelts = (numberOfStudents-freeBelts) * priceBelt;
  25.  
  26.  
  27. double totalPrice=sumSaber + sumRobes + sumBelts;
  28.  
  29. if (totalPrice<=amountOfMoney)
  30. {
  31. var a = amountOfMoney - totalPrice;
  32. Console.WriteLine($"The money is enough - it would cost {totalPrice:f2}lv.");
  33. }
  34. else
  35. {
  36. var a = totalPrice - amountOfMoney;
  37. Console.WriteLine($"Ivan Cho will need {a:f2}lv more.");
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement