Advertisement
Guest User

Toy Shop

a guest
Jan 27th, 2020
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 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 ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //  Пъзел - 2.60 лв.
  14.             //  Говореща кукла -3 лв.
  15.             //  Плюшено мече -4.10 лв.
  16.             //  Миньон - 8.20 лв.
  17.             //  Камионче - 2 лв.
  18.             //   > 50 - 25% disc
  19.             // 10 % = Loan
  20.  
  21.             double tourPrice = double.Parse(Console.ReadLine());
  22.             int puzz = int.Parse(Console.ReadLine());
  23.             int dolls = int.Parse(Console.ReadLine());
  24.             int bears = int.Parse(Console.ReadLine());
  25.             int min = int.Parse(Console.ReadLine());
  26.             int trucks = int.Parse(Console.ReadLine());
  27.  
  28.             int toysCnt = puzz + dolls + bears + min + trucks;
  29.             double toysPrice = (puzz * 2.60) + (dolls * 3) + (bears * 4.10) + (min * 8.2) + (trucks * 2);
  30.  
  31.             double afterDisc = toysPrice;
  32.  
  33.             if (toysCnt >= 50)
  34.             {
  35.                 afterDisc = toysPrice - (toysPrice * 0.25);
  36.             }
  37.  
  38.             double finalPrice = afterDisc - (afterDisc * 0.10);
  39.  
  40.             if (finalPrice >= tourPrice)
  41.             {
  42.                 Console.WriteLine($"Yes! {finalPrice - tourPrice:F2} lv left.");
  43.             }
  44.             else
  45.             {
  46.                 Console.WriteLine($"Not enough money! {tourPrice - finalPrice:F2} lv needed.");
  47.             }
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement