IvetValcheva

04. Toy Shop

Nov 7th, 2021
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 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 vacationPrice = double.Parse(Console.ReadLine());
  10.  
  11.             int puzzleQuantity = int.Parse(Console.ReadLine());
  12.             int dollsQuantity = int.Parse(Console.ReadLine());
  13.             int bearsQuantity = int.Parse(Console.ReadLine());
  14.             int minionsQuantity = int.Parse(Console.ReadLine());
  15.             int trucksQuantity = int.Parse(Console.ReadLine());
  16.  
  17.             int toysCount = puzzleQuantity + dollsQuantity + bearsQuantity + minionsQuantity + trucksQuantity;
  18.  
  19.             double puzzlePrice = puzzleQuantity * 2.60;
  20.             double dollsPrice = dollsQuantity * 3.00;
  21.             double bearsPrice = bearsQuantity * 4.10;
  22.             double minionsPrice = minionsQuantity * 8.20;
  23.             double truckPrice = trucksQuantity * 2.00;
  24.  
  25.             double profit = puzzlePrice + dollsPrice + bearsPrice + minionsPrice + truckPrice;
  26.  
  27.             if (toysCount >= 50)
  28.             {
  29.                 double discount = profit * 0.25;
  30.                 profit = profit - discount;
  31.             }
  32.             profit = profit * 0.9; //profit = profit - profit * 0.1
  33.  
  34.             if (profit >= vacationPrice)
  35.             {
  36.                 Console.WriteLine($"Yes! {(profit - vacationPrice):F2} lv left.");
  37.             }
  38.             else
  39.             {
  40.                 Console.WriteLine($"Not enough money! {(vacationPrice - profit):f2} lv needed.");
  41.             }
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment