Advertisement
Guest User

ToyShop

a guest
Nov 17th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.79 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 ekskyrziq = double.Parse(Console.ReadLine());
  10.             int puzelCount = int.Parse(Console.ReadLine());
  11.             int kykliCount = int.Parse(Console.ReadLine());
  12.             int mechetaCount = int.Parse(Console.ReadLine());
  13.             int minioniCount = int.Parse(Console.ReadLine());
  14.             int kamionchetaCount = int.Parse(Console.ReadLine());
  15.  
  16.             double d_totalPricePuzel = puzelCount * 2.6;
  17.             double d_totalPriceKykli = kykliCount * 3.0;
  18.             double d_totalPriceMecheta = mechetaCount * 4.1;
  19.             double d_totalPriceMinioni = minioniCount * 8.2;
  20.             double d_totalPriceKamioncheta = kamionchetaCount * 2.0;
  21.  
  22.             int i_toysCount = puzelCount+ kykliCount+ mechetaCount+ minioniCount+ kamionchetaCount;
  23.             double d_totalPrice = d_totalPricePuzel + d_totalPriceKykli + d_totalPriceMecheta + d_totalPriceMinioni + d_totalPriceKamioncheta;
  24.  
  25.             if (i_toysCount >= 50)
  26.             {
  27.                 double totalPriceWithOtstupka = d_totalPrice - (d_totalPrice * 0.25);
  28.                 d_totalPrice = totalPriceWithOtstupka;
  29.             }
  30.  
  31.             double d_naemMagazin = d_totalPrice - (d_totalPrice * 0.1);
  32.             d_totalPrice = d_naemMagazin;
  33.  
  34.             if (d_totalPrice >= ekskyrziq)
  35.             {
  36.                 double ostavashtiPari = d_totalPrice - ekskyrziq;
  37.                 Console.WriteLine($"Yes! {ostavashtiPari:F2} lv left.");
  38.             }
  39.             else
  40.             {
  41.                 double nedostigashtiPari = ekskyrziq - d_totalPrice;
  42.                 Console.WriteLine($"Not enough money! {nedostigashtiPari:F2} lv needed.");
  43.             }
  44.  
  45.  
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement