Advertisement
dragonbs

Toy Shop

Sep 24th, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04.ToyShop
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double priceForTrip = double.Parse(Console.ReadLine());
  10.             int numberOfPuzzels = int.Parse(Console.ReadLine());
  11.             int numberOfDolls = int.Parse(Console.ReadLine());
  12.             int numberOfBears = int.Parse(Console.ReadLine());
  13.             int numberOfMinions = int.Parse(Console.ReadLine());
  14.             int numberOfTrucks = int.Parse(Console.ReadLine());
  15.  
  16.             double priceForPuzzels = numberOfPuzzels * 2.60;
  17.             double priceForDolls = numberOfDolls * 3.0;
  18.             double priceForBears = numberOfBears * 4.10;
  19.             double priceForMinions = numberOfMinions * 8.20;
  20.             double priceForTrucks = numberOfTrucks * 2.0;
  21.  
  22.             double incom = priceForPuzzels + priceForDolls + priceForBears + priceForMinions + priceForTrucks;
  23.             int sumOfAllToys = numberOfPuzzels + numberOfDolls + numberOfBears + numberOfMinions + numberOfTrucks;
  24.  
  25.             if (sumOfAllToys >= 50)
  26.             {
  27.                 double discount = incom * 0.25;
  28.                 incom = incom - discount;
  29.             }
  30.  
  31.             double rent = incom * 0.1;
  32.  
  33.             double finalIncom = incom - rent;
  34.  
  35.             if (finalIncom >= priceForTrip)
  36.             {
  37.                 double moneyLeft = finalIncom - priceForTrip;
  38.                 Console.WriteLine($"Yes! {moneyLeft:F2} lv left.");
  39.             }
  40.             else
  41.             {
  42.                 double moneyNeeded = priceForTrip - finalIncom;
  43.                 Console.WriteLine($"Not enough money! {moneyNeeded:F2} lv needed.");
  44.             }
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement