Advertisement
llozev91

ToyShop

Jan 18th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.09 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ToyShop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double tripPrice = double.Parse(Console.ReadLine());
  10.             int puzzles = int.Parse(Console.ReadLine());
  11.             int dolls = int.Parse(Console.ReadLine());
  12.             int bears = int.Parse(Console.ReadLine());
  13.             int minions = int.Parse(Console.ReadLine());
  14.             int trucks = int.Parse(Console.ReadLine());
  15.  
  16.             double puzzlesPrice = puzzles * 2.60;
  17.             double dollsPrice = dolls * 3;
  18.             double bearsPrice = bears * 4.10;
  19.             double minionsPrice = minions * 8.20;
  20.             double trucksPrice = trucks * 2;
  21.  
  22.             double totalSum = puzzlesPrice + dollsPrice + bearsPrice + minionsPrice + trucksPrice;
  23.  
  24.             int totalToys = puzzles + dolls + bears + minions + trucks;
  25.  
  26.             if (totalToys >= 50)
  27.             {
  28.                 double afterDiscount = totalSum - (totalSum * 0.25);
  29.                 double rent = afterDiscount * 0.10;
  30.                 double profit = afterDiscount - rent;
  31.  
  32.                 if (profit >= tripPrice)
  33.                 {
  34.                     double moneyLeft = profit - tripPrice;
  35.                     Console.WriteLine($"Yes! {moneyLeft:F2} lv left.");
  36.                 }
  37.                 else
  38.                 {
  39.                     double moneyLeft = tripPrice - profit;
  40.                     Console.WriteLine($"Not enough money! {moneyLeft:F2} lv needed.");
  41.                 }
  42.             }
  43.             else
  44.             {
  45.                 double rent = totalSum * 0.10;
  46.                 double profit = totalSum - rent;
  47.  
  48.                 if (profit >= tripPrice)
  49.                 {
  50.                     double moneyLeft = profit - tripPrice;
  51.                     Console.WriteLine($"Yes! {moneyLeft:F2} lv left.");
  52.                 }
  53.  
  54.                 else
  55.                 {
  56.                     double moneyLeft = tripPrice - profit;
  57.                     Console.WriteLine($"Not enough money! {moneyLeft:F2} lv needed.");
  58.                 }
  59.             }
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement