Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P09.PadawanEquipment
- {
- class PadawanEquipment
- {
- static void Main(string[] args)
- {
- double moneyAvailable = double.Parse(Console.ReadLine());
- int studentsToCome = int.Parse(Console.ReadLine());
- double pricePerLightsaber = double.Parse(Console.ReadLine());
- double pricePerRobe = double.Parse(Console.ReadLine());
- double pricePerBelt = double.Parse(Console.ReadLine());
- double priceForAllLightsabers = Math.Ceiling(studentsToCome * 1.1) * pricePerLightsaber;
- double priceForAllRobes = studentsToCome * pricePerRobe;
- double priceForAllBelts = (studentsToCome * pricePerBelt) - (Math.Floor(studentsToCome / 6.0) * pricePerBelt);
- double totalMoneyNeeded = priceForAllBelts + priceForAllRobes + priceForAllLightsabers;
- if (moneyAvailable >= totalMoneyNeeded)
- {
- Console.WriteLine($"The money is enough - it would cost {totalMoneyNeeded:f2}lv.");
- }
- else
- {
- Console.WriteLine($"Ivan Cho will need {totalMoneyNeeded - moneyAvailable:f2}lv more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement