Advertisement
Guest User

Untitled

a guest
Oct 9th, 2019
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _9._Padawan_Equipment
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. //The amount of money Ivan Cho has – floating - point number in range[0.00…1, 000.00]
  10. // The count of students – integer in range[0…100]
  11. // The price of lightsabers for a single sabre – floating - point number in range[0.00…100.00]
  12. // The price of robes for a single robe – floating - point number in range[0.00…100.00]
  13. // The price of belts for a single belt – floating - point number in range[0.00…100.00]
  14.  
  15.  
  16. double money = double.Parse(Console.ReadLine());
  17. int students = int.Parse(Console.ReadLine());
  18. double priceForLightsabers = double.Parse(Console.ReadLine());
  19. double priceForRobes = double.Parse(Console.ReadLine());
  20. double priceForBelts = double.Parse(Console.ReadLine());
  21.  
  22. double totalPrice = 0;
  23. double belts = 0;
  24. double students1 = Math.Ceiling((students * 0.1) + students);
  25.  
  26.  
  27.  
  28. if ( students >= 6)
  29. {
  30. for (int i = 1; i < students; i+=6)
  31. {
  32. belts--;
  33. }
  34. }
  35.  
  36. totalPrice = (students1 * priceForLightsabers) + ((students+belts) * priceForBelts) + (students * priceForRobes);
  37.  
  38. if ( totalPrice > money)
  39. {
  40. Console.WriteLine($"Ivan Cho will need {totalPrice - money:f2}lv more.");
  41. }
  42. else if (totalPrice <= money)
  43. {
  44. Console.WriteLine($"The money is enough - it would cost {totalPrice:f2}lv.");
  45. }
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement