Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _09._Padawan_Equipment
- {
- class Program
- {
- static void Main(string[] args)
- {
- float budget = float.Parse(Console.ReadLine());
- double students = double.Parse(Console.ReadLine());
- float saberPrice = float.Parse(Console.ReadLine());
- float robesPrice = float.Parse(Console.ReadLine());
- float beltsPrice = float.Parse(Console.ReadLine());
- //we should buy 10% more sabers
- //every 6th belt is free
- double numSabers = Math.Ceiling(students + (students * 0.10));
- double totalSaberPrice = saberPrice * numSabers;
- double totalRobesPrice = robesPrice * students;
- int totalFreeBelts = (int)students / 6;
- double totalBeltsPrice = beltsPrice * (students - totalFreeBelts);
- double totalMoneyNeed = totalSaberPrice + totalRobesPrice + totalBeltsPrice;
- if (totalMoneyNeed > budget)
- {
- Console.WriteLine($"Ivan Cho will need {totalMoneyNeed-budget:f2}lv more.");
- }
- else
- {
- Console.WriteLine($"The money is enough - it would cost {totalMoneyNeed:f2}lv.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement