Advertisement
Destinote

Padawan Equipment

Sep 25th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P09.PadawanEquipment
  4. {
  5.     class PadawanEquipment
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double moneyAvailable = double.Parse(Console.ReadLine());
  10.             int studentsToCome = int.Parse(Console.ReadLine());
  11.             double pricePerLightsaber = double.Parse(Console.ReadLine());
  12.             double pricePerRobe = double.Parse(Console.ReadLine());
  13.             double pricePerBelt = double.Parse(Console.ReadLine());
  14.  
  15.             double priceForAllLightsabers = Math.Ceiling(studentsToCome * 1.1) * pricePerLightsaber;
  16.             double priceForAllRobes = studentsToCome * pricePerRobe;
  17.             double priceForAllBelts = (studentsToCome * pricePerBelt) - (Math.Floor(studentsToCome / 6.0) * pricePerBelt);
  18.  
  19.             double totalMoneyNeeded = priceForAllBelts + priceForAllRobes + priceForAllLightsabers;
  20.  
  21.             if (moneyAvailable >= totalMoneyNeeded)
  22.             {
  23.                 Console.WriteLine($"The money is enough - it would cost {totalMoneyNeeded:f2}lv.");
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine($"Ivan Cho will need {totalMoneyNeeded - moneyAvailable:f2}lv more.");
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement