kaloyanTry

Equipment

Sep 23rd, 2020
761
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace EquipmentPadawan
  4. {
  5.     class Equipment
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double amounMoney = double.Parse(Console.ReadLine());
  10.             int studentsNum = 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.             int freeBeslts = 0;
  15.             int moreLightsabers = 0;
  16.  
  17.             moreLightsabers = (int)Math.Ceiling(studentsNum + (studentsNum * 0.1));
  18.  
  19.             int studentsFreeBelts = studentsNum;
  20.  
  21.             do
  22.             {
  23.                 if (studentsFreeBelts % 6 == 0)
  24.                 {
  25.                     freeBeslts += 1;
  26.                 }
  27.                 studentsFreeBelts--;
  28.  
  29.             } while (studentsFreeBelts >= 6);
  30.            
  31.             double sumEquipmentn = 0;
  32.  
  33.             sumEquipmentn = (priceLightsabers * moreLightsabers) + (priceRobes * studentsNum) + (priceBelts * (studentsNum - freeBeslts));
  34.  
  35.             if (amounMoney >= sumEquipmentn)
  36.             {
  37.                 Console.WriteLine($"The money is enough - it would cost {sumEquipmentn:F2}lv.");
  38.             }
  39.             else
  40.             {
  41.                 Console.WriteLine($"Ivan Cho will need {(sumEquipmentn - amounMoney):F2}lv more.");
  42.             }
  43.  
  44.         }
  45.     }
  46. }
  47.  
RAW Paste Data