Advertisement
knoteva

Untitled

Oct 9th, 2019
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _9._Padawan_Equipment
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //The amount of money Ivan Cho has – floating - point number in range[0.00…1, 000.00]
  10.             // The count of students – integer in range[0…100]
  11.             // The price of lightsabers for a single sabre – floating - point number in range[0.00…100.00]
  12.             //  The price of robes for a single robe – floating - point number in range[0.00…100.00]
  13.             //   The price of belts for a single belt – floating - point number in range[0.00…100.00]
  14.  
  15.  
  16.             double money = double.Parse(Console.ReadLine());
  17.             int students = int.Parse(Console.ReadLine());
  18.             double priceForLightsabers = double.Parse(Console.ReadLine());
  19.             double priceForRobes = double.Parse(Console.ReadLine());
  20.             double priceForBelts = double.Parse(Console.ReadLine());
  21.  
  22.             double totalPrice = 0;
  23.             int belts = students / 6;
  24.             double students1 = Math.Ceiling((students * 0.1) + students);
  25.  
  26.  
  27.  
  28.          
  29.  
  30.             totalPrice = (students1 * priceForLightsabers) + ((students-belts) * priceForBelts) + (students * priceForRobes);
  31.  
  32.             if ( totalPrice > money)
  33.             {
  34.                 Console.WriteLine($"Ivan Cho will need {totalPrice - money:f2}lv more.");
  35.             }
  36.             else if (totalPrice <= money)
  37.             {
  38.                 Console.WriteLine($"The money is enough - it would cost {totalPrice:f2}lv.");
  39.             }
  40.  
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement