f0rc3ful

Padawan equipment

May 20th, 2023
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. double balance = double.Parse(Console.ReadLine());
  8. int counter = int.Parse(Console.ReadLine());
  9. double lightsaber = double.Parse(Console.ReadLine());
  10. double robe = double.Parse(Console.ReadLine());
  11. double belt = double.Parse(Console.ReadLine());
  12. double beltCost = counter * belt;
  13. //
  14. //
  15. double saberCost = Math.Ceiling(counter * 1.1) * lightsaber;
  16. double dfk = Math.Ceiling(counter * 1.1);
  17. double total = 0;
  18.  
  19. if (counter >= 6)
  20. {
  21. beltCost *= (5.0 / 6.0);
  22. }
  23. total = saberCost + counter * robe + beltCost;
  24.  
  25. if (total <= balance)
  26. {
  27. Console.WriteLine($"The money is enough - it would cost {total}lv.");
  28. }
  29. else
  30. {
  31. double remaining = total - balance;
  32. Console.WriteLine($"John will need {remaining:D2}lv more.");
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment