Advertisement
AleksandarGG

02. Toy Shop

Jul 13th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 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 _02.Toy_Shop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double priceExcursion = double.Parse(Console.ReadLine());
  14.             int puzzel = int.Parse(Console.ReadLine());
  15.             int dols = int.Parse(Console.ReadLine());
  16.             int bears = int.Parse(Console.ReadLine());
  17.             int minions = int.Parse(Console.ReadLine());
  18.             int trucks = int.Parse(Console.ReadLine());
  19.  
  20.             double pricePuzzel = 2.60;
  21.             double priceDols = 3.0;
  22.             double priceBear = 4.10;
  23.             double priceMinios = 8.20;
  24.             double priceTruck = 2.0;
  25.             double discount25PerCent = 0.75;
  26.             double rent10PerCent = 0.10;
  27.  
  28.             double sum = puzzel * pricePuzzel + dols * priceDols + bears * priceBear + minions * priceMinios + trucks * priceTruck;
  29.  
  30.             double countOfToys = puzzel + dols + bears + minions + trucks;
  31.            
  32.             double diff = sum - (sum * rent10PerCent) ;
  33.  
  34.             if (countOfToys >= 50)
  35.  
  36.             {
  37.                 double priceWithDiscount = sum * discount25PerCent;
  38.                 double totalEarnPrice = priceWithDiscount - (priceWithDiscount * rent10PerCent);
  39.                 if (totalEarnPrice >= priceExcursion)
  40.                 {
  41.                     Console.WriteLine($"Yes! {totalEarnPrice - priceExcursion :f2} lv left.");
  42.                 }
  43.                
  44.             }
  45.             else
  46.             {
  47.                 Console.WriteLine($"Not enough money! {Math.Abs(diff - priceExcursion):f2} lv needed.");
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement