Advertisement
elena1234

Padawan Equipment

Sep 25th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System;
  2. namespace PadawanEquipment
  3. {
  4.     class MainClass
  5.     {
  6.         public static void Main(string[] args)
  7.         {
  8.             double moneyBalance = double.Parse(Console.ReadLine());
  9.             int countStudent = int.Parse(Console.ReadLine());
  10.             double priceLightSaber = double.Parse(Console.ReadLine());
  11.             double priceRobe = double.Parse(Console.ReadLine());
  12.             double priceBelt = double.Parse(Console.ReadLine());
  13.  
  14.             double totalLightSabersPrice = Math.Ceiling(countStudent+0.1*countStudent) * priceLightSaber;
  15.             double totalRobesPrice =countStudent * priceRobe;
  16.             double totalBeltPrice = countStudent * priceBelt;
  17.  
  18.             int freeBelt =(countStudent / 6);
  19.            
  20.             double totalPriceOfAll = totalLightSabersPrice  + totalRobesPrice + (totalBeltPrice - (freeBelt*priceBelt));
  21.  
  22.             if (moneyBalance >= totalPriceOfAll)
  23.             {
  24.                 Console.WriteLine($"The money is enough - it would cost {totalPriceOfAll:f2}lv.");
  25.             }
  26.  
  27.             else if (moneyBalance < totalPriceOfAll)
  28.             {
  29.                 Console.WriteLine($"Ivan Cho will need {totalPriceOfAll-moneyBalance:f2}lv more.");
  30.             }
  31.  
  32.         }
  33.     }
  34. }
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement