MeGaDeTH_91

Padawan Equipment

Apr 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PadawanEq
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. decimal moneyAmount = decimal.Parse(Console.ReadLine());
  10.  
  11. int studentsCount = int.Parse(Console.ReadLine());
  12.  
  13. decimal lightSaberPrice = decimal.Parse(Console.ReadLine());
  14.  
  15. decimal robePrice = decimal.Parse(Console.ReadLine());
  16.  
  17. decimal beltPrice = decimal.Parse(Console.ReadLine());
  18.  
  19. int freeBelts = studentsCount / 6;
  20. decimal something = lightSaberPrice * (studentsCount + Math.Ceiling(10 / 100.0m * studentsCount));
  21. decimal result = something + robePrice * studentsCount + beltPrice * (studentsCount - freeBelts);
  22.  
  23. decimal moneyDifference = moneyAmount - result;
  24.  
  25. if(moneyDifference >= 0)
  26. {
  27. Console.WriteLine($"The money is enough - it would cost {result:F2}lv.");
  28. }
  29. else
  30. {
  31. moneyDifference = Math.Abs(moneyDifference);
  32.  
  33. Console.WriteLine($"Ivan Cho will need {moneyDifference:F2}lv more.");
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment