Advertisement
WindFell

Padawan Equipment

Mar 16th, 2018
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. class PadawanEquipment
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         double money = double.Parse(Console.ReadLine());
  8.         int studentsCount = int.Parse(Console.ReadLine());
  9.         double lightSaberPrice = double.Parse(Console.ReadLine());
  10.         double robePrice = double.Parse(Console.ReadLine());
  11.         double beltPrice = double.Parse(Console.ReadLine());
  12.  
  13.         int lightSabersCount = Convert.ToInt32(Math.Ceiling(studentsCount * 1.1));
  14.         int robesCount = studentsCount;
  15.         int beltsCount = studentsCount - studentsCount / 6;
  16.         double totalPrice = lightSabersCount * lightSaberPrice + robesCount * robePrice + beltsCount * beltPrice;
  17.  
  18.         if (money >= totalPrice)
  19.         {
  20.             Console.WriteLine($"The money is enough - it would cost {totalPrice:F2}lv.");
  21.         }
  22.         else
  23.         {
  24.             Console.WriteLine($"Ivan Cho will need {totalPrice - money:F2}lv more.");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement