Advertisement
Guest User

Untitled

a guest
Sep 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _09.Padawan_Equipment
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double moneyStart = double.Parse(Console.ReadLine());
  14. int student = int.Parse(Console.ReadLine());
  15. double lightsaberPerOne = double.Parse(Console.ReadLine());
  16. double roberPerOne = double.Parse(Console.ReadLine());
  17. double beltsPerOne = double.Parse(Console.ReadLine());
  18.  
  19. int numberOfSabers = (int)Math.Ceiling(student * 1.10);
  20. int numberOfRobes = student;
  21. int numberOfBelts = student - (student / 6);
  22.  
  23. double moneyNeeded = (lightsaberPerOne * numberOfSabers) + (roberPerOne * numberOfRobes) + (beltsPerOne * numberOfBelts);
  24.  
  25. double left = moneyStart - moneyNeeded;
  26.  
  27. if (left >= 0)
  28. {
  29. Console.WriteLine($"The money is enough - it would cost {moneyNeeded:f2}lv.");
  30. }
  31. else
  32. {
  33. Console.WriteLine($"Ivan Cho will need {Math.Abs(left):f2}lv more.");
  34. }
  35.  
  36.  
  37.  
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement