Advertisement
saimun1

[TEST EXAM] 02.TOY SHOP

Jul 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 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 Practicing
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double puzel = 2.60;
  14.             double kukla = 3;
  15.             double meche = 4.10;
  16.             double minion = 8.20;
  17.             double kamionche = 2;
  18.  
  19.             double price = double.Parse(Console.ReadLine());
  20.             int puzelBr = int.Parse(Console.ReadLine());
  21.             int kuklaBr = int.Parse(Console.ReadLine());
  22.             int mecheBr = int.Parse(Console.ReadLine());
  23.             int minionBr = int.Parse(Console.ReadLine());
  24.             int kamionBr = int.Parse(Console.ReadLine());
  25.  
  26.             int quantity = kuklaBr + mecheBr + kamionBr + puzelBr + minionBr;
  27.  
  28.             Boolean fiftyOrGreater = quantity >= 50;
  29.             puzel *= puzelBr;
  30.             kukla *= kuklaBr;
  31.             meche *= mecheBr;
  32.             minion *= minionBr;
  33.             kamionche *= kamionBr;
  34.             double total = puzel + kukla + meche + minion + kamionche;
  35.             if (fiftyOrGreater)
  36.                 total *= 0.75;
  37.             total *= 0.90;
  38.             if (total >= price)
  39.             {
  40.                 double left = total - price;
  41.                 Console.WriteLine("Yes! {0:f2} lv left.", left);
  42.  
  43.             }
  44.             else
  45.             {
  46.                 double need = price - total;
  47.                 Console.WriteLine($"Not enough money! {need:f2} lv needed.");
  48.  
  49.  
  50.             }
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement