Advertisement
Guest User

PadwanEquipment

a guest
Sep 23rd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PadawanEquipment
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double money = double.Parse(Console.ReadLine());
  10.             int numberOfStudents = int.Parse(Console.ReadLine());
  11.             double priceLightsabers = double.Parse(Console.ReadLine());
  12.             double priceRobes = double.Parse(Console.ReadLine());
  13.             double priceBelts = double.Parse(Console.ReadLine());
  14.             double lightSabers = Math.Ceiling(numberOfStudents +  numberOfStudents*0.1);
  15.             int freeBelts = numberOfStudents / 6;
  16.             double totalMoneyNeeded = lightSabers * priceLightsabers + numberOfStudents * priceRobes + (numberOfStudents - freeBelts) * priceBelts;
  17.             if (money >= totalMoneyNeeded)
  18.             {
  19.                 Console.WriteLine($"The money is enough - it would cost {totalMoneyNeeded:f2}lv.");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine($"Ivan Cho will need {totalMoneyNeeded-money:f2}lv more.");
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement