Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Padawan_Equipment
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double budged = double.Parse(Console.ReadLine());
  10. int studentsCount = int.Parse(Console.ReadLine());
  11. double lightsabersPrice = double.Parse(Console.ReadLine());
  12. double robesPrice = double.Parse(Console.ReadLine());
  13. double beltsPrice = double.Parse(Console.ReadLine());
  14.  
  15.            double additionalEquipment = Math.Ceiling(studentsCount * 1.1);
  16. double totalSabersPrice = lightsabersPrice * additionalEquipment;
  17. double totalRobesPrice = robesPrice * studentsCount;
  18. double totalBeltsPrice = beltsPrice * studentsCount;
  19.  
  20. double totalPrice = totalSabersPrice + totalRobesPrice + totalBeltsPrice;
  21.  
  22. for (int i = 1; i <= studentsCount; i++)
  23. {
  24. if (i % 6 == 0)
  25. {
  26. totalPrice -= beltsPrice;
  27. }
  28. }
  29.  
  30. if (budged >= totalPrice)
  31. {
  32. Console.WriteLine($"The money is enough - it would cost {totalPrice:F2}lv.");
  33. }
  34.  
  35. else
  36. {
  37. double diff = totalPrice - budged;
  38. Console.WriteLine($"Ivan Cho will need {diff:F2}lv more.");
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement