Advertisement
poli_rk

Untitled

Sep 22nd, 2020
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _9.PadawanEquipment
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double budget = double.Parse(Console.ReadLine());
  10. int studentsCount = int.Parse(Console.ReadLine());
  11. double lightsaberPrice = double.Parse(Console.ReadLine());
  12. double robePrice = double.Parse(Console.ReadLine());
  13. double beltPrice = double.Parse(Console.ReadLine());
  14.  
  15. double totalPriceSabers = lightsaberPrice * Math.Ceiling(studentsCount * 1.1);
  16. double totalPriceRobes = robePrice * studentsCount;
  17. double freeBelts = studentsCount / 6;
  18. double totalPriceBelts = beltPrice * (studentsCount - freeBelts);
  19.  
  20. double neededMoney = totalPriceSabers + totalPriceRobes + totalPriceBelts;
  21.  
  22. if (neededMoney <= budget)
  23. {
  24. Console.WriteLine($"The money is enough - it would cost {neededMoney:F2}lv.");
  25. }
  26. else
  27. {
  28. Console.WriteLine($"Ivan Cho will need {neededMoney - budget:F2}lv more.");
  29. }
  30. }
  31. }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement