daily pastebin goal
4%
SHARE
TWEET

Padawan Equipment

Destinote Sep 25th, 2018 136 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top