anizko

09. Padawan Equipment

May 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _9.Padawan_Equipment
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double GivenMoney = double.Parse(Console.ReadLine());
  14.  
  15.             double studentsCount = double.Parse(Console.ReadLine());
  16.  
  17.             double priceLightsabers = double.Parse(Console.ReadLine());
  18.             double priceRobes = double.Parse(Console.ReadLine());
  19.             double priceBelts = double.Parse(Console.ReadLine());
  20.  
  21.             double freeBelts = Math.Floor(studentsCount / 6);
  22.             double ExtraLightsabers = Math.Ceiling(studentsCount + (studentsCount * 10 / 100));
  23.  
  24.             double priceLightsabersStudents =  ExtraLightsabers * priceLightsabers;
  25.             double priceRobesStudents = studentsCount * priceRobes;
  26.             double priceBeltsStudents = (priceBelts * studentsCount) - (freeBelts * priceBelts);
  27.  
  28.             double priceForAllStudents = priceLightsabersStudents + priceRobesStudents + priceBeltsStudents;
  29.  
  30.             if (GivenMoney >= priceForAllStudents)
  31.             {
  32.                 Console.WriteLine($"The money is enough - it would cost {priceForAllStudents:f2}lv.");
  33.             }
  34.             else
  35.             {
  36.                 Console.WriteLine($"Ivan Cho will need {Math.Abs(GivenMoney - priceForAllStudents):f2}lv more.");
  37.             }
  38.  
  39.  
  40.  
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment