Advertisement
mihael03

Toy_Shop

Sep 27th, 2020
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Toy_Shop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             decimal puzzle = 2.60m;
  10.             decimal talkingDoll = 3;
  11.             decimal fluffyBear = 4.10m;
  12.             decimal minion = 8.20m;
  13.             decimal truck = 2;
  14.  
  15.             decimal sumForHoliday = decimal.Parse(Console.ReadLine());
  16.             int numberOfPuzzles = int.Parse(Console.ReadLine());
  17.             int numberOfTalkingDolls = int.Parse(Console.ReadLine());
  18.             int numberOfFluffyBears = int.Parse(Console.ReadLine());
  19.             int numberOfMinions = int.Parse(Console.ReadLine());
  20.             int numberOfTrucks = int.Parse(Console.ReadLine());
  21.  
  22.             decimal sumForToys = (numberOfPuzzles * puzzle) + (numberOfTalkingDolls * talkingDoll) + (numberOfFluffyBears * fluffyBear) + (numberOfMinions * minion) + (numberOfTrucks * truck);
  23.             int numberOfToys = numberOfPuzzles + numberOfTalkingDolls + numberOfTalkingDolls + numberOfMinions + numberOfTrucks;
  24.  
  25.             if (numberOfToys >= 50)
  26.             {
  27.                 decimal discount = sumForToys * 0.75m;
  28.             }
  29.  
  30.             decimal rent = sumForToys * 0.10m;
  31.             decimal profit = sumForToys - rent;
  32.  
  33.             if(sumForToys >= sumForHoliday)
  34.             {
  35.                 decimal last = sumForToys - sumForHoliday;
  36.                 Console.WriteLine("Yes! {0:F2} lv left.", last);
  37.             }
  38.             else
  39.             {
  40.                 decimal needed = sumForHoliday - sumForToys;
  41.                 Console.WriteLine("Not enough money! {0:F2} lv needed.", needed);
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement