bullit3189

Padawan Equipment - Intro and Basic Syntax

Jan 24th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5.  
  6. public class Program
  7. {
  8. public static void Main()
  9. {
  10. double budget = double.Parse(Console.ReadLine());
  11. int students = int.Parse(Console.ReadLine());
  12. double pricePerSaber = double.Parse(Console.ReadLine());
  13. double pricePerRobe = double.Parse(Console.ReadLine());
  14. double pricePerBelt = double.Parse(Console.ReadLine());
  15.  
  16. double totalRobesPrice =Math.Round(pricePerRobe * students,2);
  17.  
  18. double sabresNeeded =Math.Ceiling(students * 1.10);
  19. double totalSabresPrice =Math.Round(sabresNeeded*pricePerSaber,2);
  20.  
  21. int freeBelts = students /6;
  22. int beltsNeeded = students - freeBelts;
  23. double totalBeltsPrice =Math.Round(beltsNeeded * pricePerBelt,2);
  24.  
  25. double totalCost =Math.Round(totalRobesPrice + totalSabresPrice + totalBeltsPrice,2);
  26.  
  27. if (totalCost <= budget)
  28. {
  29. Console.WriteLine("The money is enough - it would cost {0:f2}lv.", totalCost);
  30. }
  31. else
  32. {
  33. Console.WriteLine("Ivan Cho will need {0:f2}lv more.", totalCost-budget);
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment