Advertisement
HRusev

Padawan Equipment

May 16th, 2024
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | Source Code | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Globalization;
  7.  
  8. namespace _09.PadawanEquipment
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string line = Console.ReadLine();
  15.             double money = double.Parse(line);
  16.  
  17.             line = Console.ReadLine();
  18.             int countStudents = Int32.Parse(line);
  19.  
  20.             double priceLightsaber = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  21.             double priceRobe = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  22.             double priceBelt = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
  23.  
  24.             double needMoney = (priceLightsaber * Math.Ceiling(countStudents * 1.1)) + (priceRobe * countStudents) + (priceBelt * (countStudents - (countStudents / 6)));
  25.        
  26.             if (needMoney <= money)
  27.                 Console.WriteLine($"The money is enough - it would cost {needMoney, 0:N2}lv.");
  28.             else
  29.                 Console.WriteLine($"John will need {needMoney - money, 0:N2}lv more.");
  30.  
  31.         }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement