M0Hk

ToyShop

Feb 16th, 2020
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ToyShop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             double vacationPrice = double.Parse(Console.ReadLine());
  11.             int numPuzzles = int.Parse(Console.ReadLine());
  12.             int numTalkingDolls = int.Parse(Console.ReadLine());
  13.             int numBears = int.Parse(Console.ReadLine());
  14.             int numMinions = int.Parse(Console.ReadLine());
  15.             int numTrucks = int.Parse(Console.ReadLine());
  16.  
  17.             double total = numPuzzles * 2.60 + numTalkingDolls * 3 + numBears * 4.10 + numMinions * 8.20 + numTrucks * 2;
  18.            
  19.             int numToys = numPuzzles + numTalkingDolls + numBears + numMinions + numTrucks;
  20.  
  21.             if (numToys >= 50)
  22.             {
  23.                 total = total - total * 0.25;
  24.             }
  25.            
  26.             total = total - total * 0.10;
  27.  
  28.             if (total >= vacationPrice)
  29.             {
  30.                 Console.WriteLine($"Yes! {total - vacationPrice:f2} lv left.");
  31.             }
  32.             else
  33.             {
  34.                 Console.WriteLine($"Not enough money! {vacationPrice - total:f2} lv needed.");
  35.             }
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment