petaryankov00

09.Padawan Equipment

Sep 19th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 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 amountOfMoney = double.Parse(Console.ReadLine());
  10.             double countOfStudents = int.Parse(Console.ReadLine());
  11.             double priceOfLight = double.Parse(Console.ReadLine());
  12.             double priceOfRobes = double.Parse(Console.ReadLine());
  13.             double priceOfBelts = double.Parse(Console.ReadLine());
  14.  
  15.             double totalSumLights = priceOfLight * Math.Round(countOfStudents * 1.1 + 1);
  16.             double totalSumRobes = priceOfRobes * countOfStudents;
  17.             double totalSumBelts = priceOfBelts * (countOfStudents - Math.Round(countOfStudents / 6));
  18.             double totalPrice = totalSumBelts + totalSumLights + totalSumRobes;
  19.  
  20.             if (totalPrice <= amountOfMoney)
  21.             {
  22.                 Console.WriteLine($"The money is enough - it would cost {totalPrice:f2}lv.");  
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine($"Ivan Cho will need {totalPrice-amountOfMoney:f2}lv more.");
  27.             }
  28.  
  29.         }
  30.     }
  31. }
  32.  
Add Comment
Please, Sign In to add comment