Advertisement
dragonbs

04 ToyShop

Mar 8th, 2023
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using System;
  2.  
  3. internal class Program
  4. {
  5.     static void Main()
  6.     {
  7.         double vacationPrice = double.Parse(Console.ReadLine());
  8.         int puzzlesAmount = int.Parse(Console.ReadLine());
  9.         int dollsAmount = int.Parse(Console.ReadLine());
  10.         int bearsAmount = int.Parse(Console.ReadLine());
  11.         int minionAmount = int.Parse(Console.ReadLine());
  12.         int truckAmount = int.Parse(Console.ReadLine());
  13.  
  14.         double puzzles = puzzlesAmount * 2.60;
  15.         double dolls = dollsAmount * 3.00;
  16.         double bears = bearsAmount * 4.10;
  17.         double minion = minionAmount * 8.20;
  18.         double truck = truckAmount * 2.00;
  19.  
  20.         double total = puzzles + dolls + bears + minion + truck;
  21.         int toysNum = puzzlesAmount + dollsAmount + bearsAmount + minionAmount + truckAmount;
  22.         if (toysNum >= 50) total -= 0.25 * total;
  23.         total -= 0.1 * total;
  24.  
  25.         if (total >= vacationPrice) Console.WriteLine($"Yes! {(total - vacationPrice):f2} lv left.");
  26.         else Console.WriteLine($"Not enough money! {(vacationPrice - total):f2} lv needed.");
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement