Advertisement
MARINA_GREBENAROVA

Toy Shop

Sep 23rd, 2021
1,093
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ToyShop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double priceTrip = double.Parse(Console.ReadLine());
  10.             int countPuzzle = int.Parse(Console.ReadLine());
  11.             int countDolls = int.Parse(Console.ReadLine());
  12.             int countBears = int.Parse(Console.ReadLine());
  13.             int countMinions = int.Parse(Console.ReadLine());
  14.             int countTrucks = int.Parse(Console.ReadLine());
  15.  
  16.             double priceToys = countPuzzle * 2.60 + countDolls * 3 + countBears * 4.10 + countMinions * 8.20 + countTrucks * 2;
  17.             int countToys = countPuzzle + countDolls + countBears + countMinions + countTrucks;
  18.  
  19.             if (countToys >= 50)
  20.             {
  21.                 priceToys -= priceToys * 0.25;
  22.            
  23.             }
  24.  
  25.             priceToys -= priceToys * 0.1;
  26.  
  27.             if (priceToys>=priceTrip)
  28.             {
  29.                 Console.WriteLine($"Yes! {priceToys-priceTrip:F2} lv left.");
  30.             }
  31.             else {
  32.                 Console.WriteLine($"Not enough money! {priceTrip-priceToys:F2} lv needed.");
  33.             }
  34.            
  35.  
  36.  
  37.  
  38.         }
  39.     }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement