Advertisement
Guest User

toy storee

a guest
Jun 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Magazin_za_igrachki
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double holidayPrice = double.Parse(Console.ReadLine());
  14.             int puzzles = int.Parse(Console.ReadLine());
  15.             int dalls = int.Parse(Console.ReadLine());
  16.             int fluffBears = int.Parse(Console.ReadLine());
  17.             int minions = int.Parse(Console.ReadLine());
  18.             int trucks = int.Parse(Console.ReadLine());
  19.  
  20.             double puzzlesPrice = 2.60;
  21.             int dallPrice = 3;
  22.             double fluffBearPrice = 4.10;
  23.             double minionPrice = 8.20;
  24.             int trucksPrice = 2;
  25.  
  26.             double finalToyPrice = (puzzles * puzzlesPrice + dalls * dallPrice + fluffBears * fluffBearPrice + minions * minionPrice + trucks * trucksPrice);
  27.             double numOfToys = (puzzles + dalls + fluffBears + minions + trucks);
  28.             double discount = 0;
  29.  
  30.             if (numOfToys >= 50)
  31.             {
  32.                 discount = finalToyPrice - (finalToyPrice * 0.75);
  33.  
  34.             }
  35.             double totalEarnings = finalToyPrice - discount;
  36.             double storeRent = totalEarnings - (totalEarnings * 0.90);
  37.             double finalPrice = totalEarnings - storeRent;
  38.             if (finalPrice >= holidayPrice)
  39.             {
  40.                 Console.WriteLine($"Yes! {finalPrice - holidayPrice:f2} lv left.");
  41.             }
  42.             else
  43.             {
  44.                 Console.WriteLine($"Not enough money! {holidayPrice - finalPrice:f2} lv needed.");
  45.             }
  46.  
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement