Advertisement
Guest User

Toy Shop C#

a guest
Sep 17th, 2018
139
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 Toy_Shop
  8. {
  9.     class Toy_shop
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double vacantion = double.Parse(Console.ReadLine());
  14.             int puzzle = int.Parse(Console.ReadLine());
  15.             int talkingDoll = int.Parse(Console.ReadLine());
  16.             int bearDoll = int.Parse(Console.ReadLine());
  17.             int minion = int.Parse(Console.ReadLine());
  18.             int toyTruck = int.Parse(Console.ReadLine());
  19.  
  20.             double puzzlePrice = 2.60;
  21.             int talkingDollPrice = 3;
  22.             double bearDollPrice = 4.10;
  23.             double minionPrice = 8.20;
  24.             int toyTruckPrice = 2;
  25.  
  26.             double totalMoney = (puzzle * puzzlePrice) +
  27.                 (talkingDoll * talkingDollPrice) +
  28.                 (bearDoll * bearDollPrice) +
  29.                 (minion * minionPrice) +
  30.                 (toyTruck * toyTruckPrice);
  31.  
  32.             int totalToys = puzzle + talkingDoll + bearDoll + minion + toyTruck;
  33.  
  34.             double discount = 0;
  35.  
  36.             if (totalToys >= 50)
  37.             {
  38.                 discount = totalMoney * 0.25;
  39.             }
  40.            
  41.             double finalSum = totalMoney - discount;
  42.             double rent = finalSum * 0.10;
  43.             double profit = finalSum - rent;
  44.  
  45.             if (profit > vacantion)
  46.             {
  47.                 double moneyLeft = profit - vacantion;
  48.                 Console.WriteLine($"Yes! {moneyLeft:F2} lv left.");
  49.             }
  50.             else
  51.             {
  52.                 double moneyNeeded = vacantion - profit;
  53.                 Console.WriteLine($"Not enough money! {moneyNeeded:F2} lv needed.");
  54.             }
  55.            
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement