alexbancheva

Toy Shop

Nov 28th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Toys_shop_2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double priceTrip = double.Parse(Console.ReadLine());
  10.             int countOfPuzzle = int.Parse(Console.ReadLine());
  11.             int countOfDolls = int.Parse(Console.ReadLine());
  12.             int countOfBears = int.Parse(Console.ReadLine());
  13.             int countOfMinions = int.Parse(Console.ReadLine());
  14.             int countOfTrucks = int.Parse(Console.ReadLine());
  15.  
  16.             double countOfToys = countOfPuzzle + countOfDolls + countOfBears + countOfMinions + countOfTrucks;
  17.             double totalPrice = countOfPuzzle * 2.60 + countOfDolls * 3 + countOfBears * 4.10 + countOfMinions * 8.20 + countOfTrucks * 2;
  18.  
  19.             if (countOfToys >= 50)
  20.             {
  21.            
  22.                 totalPrice = totalPrice * 0.75;
  23.                 totalPrice = totalPrice * 0.90;
  24.             }
  25.             else if (countOfToys < 50)
  26.             {
  27.              
  28.  
  29.                 totalPrice = totalPrice * 0.90;
  30.             }
  31.  
  32.             if (totalPrice >= priceTrip)
  33.             {
  34.                 Console.WriteLine($"Yes! {totalPrice - priceTrip:f2} lv left.");
  35.             }
  36.             else
  37.             {
  38.                 Console.WriteLine($"Not enough money! {priceTrip - totalPrice:f2} lv needed.");
  39.             }
  40.            
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment