StoimenK

C# 2.9 Padawan Equipment

Jan 23rd, 2020
101
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _2._9_Padawan_Equipment
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double amountMoney = double.Parse(Console.ReadLine());
  14.             int countStudents = int.Parse(Console.ReadLine());
  15.             double priceLightsabers = double.Parse(Console.ReadLine());
  16.             double priceRobes = double.Parse(Console.ReadLine());
  17.             double priceBelts = double.Parse(Console.ReadLine());
  18.  
  19.             double totalpriceLightsabers = priceLightsabers * Math.Ceiling(countStudents * 1.1);
  20.             double totalPraiceRobes = priceRobes * countStudents;
  21.  
  22.             double totalPriceBelts = (priceBelts * countStudents) - (countStudents / 6 * priceBelts);
  23.             double totalPrice = totalpriceLightsabers + totalPriceBelts + totalPraiceRobes;
  24.  
  25.             if (amountMoney >= totalPrice)
  26.             {
  27.                 Console.WriteLine($"The money is enough - it would cost {totalPrice:F2}lv.");
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine($"Ivan Cho will need {totalPrice - amountMoney:F2}lv more.");
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment