Advertisement
simonradev

Toys

Jun 1st, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 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 _2.Магазин_за_детски_играчки
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double puzzlePrice = 2.60;
  14.             double dollPrice = 3.00;
  15.             double bearPrice = 4.10;
  16.             double minionPrice = 8.20;
  17.             double truckPrice = 2.00;
  18.  
  19.             double travelPrice = double.Parse(Console.ReadLine());
  20.             double puzzleCount = double.Parse(Console.ReadLine());
  21.             double dollCount = double.Parse(Console.ReadLine());
  22.             double bearCount = double.Parse(Console.ReadLine());
  23.             double minionCount = double.Parse(Console.ReadLine());
  24.             double truckCount = double.Parse(Console.ReadLine());
  25.  
  26.             double moneyFromToys = puzzlePrice * puzzleCount +
  27.                                    dollCount * dollPrice +
  28.                                    bearPrice * bearCount +
  29.                                    minionPrice * minionCount +
  30.                                    truckPrice * truckCount;
  31.  
  32.             double amountOfToys = puzzleCount + dollCount + minionCount + truckCount + bearCount;
  33.  
  34.             if (amountOfToys >= 50)
  35.             {
  36.                 moneyFromToys *= 0.75;
  37.             }
  38.  
  39.             moneyFromToys *= 0.9;
  40.  
  41.             if (moneyFromToys >= travelPrice)
  42.             {
  43.                 double rest = moneyFromToys - travelPrice;
  44.                 Console.WriteLine($"Yes! {rest:F2} lv left.");
  45.             }
  46.             else
  47.             {
  48.                 double deficit = travelPrice - moneyFromToys;
  49.                 Console.WriteLine($"Not enough money! {deficit:F2} lv needed.");
  50.             }
  51.         }
  52.  
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement