tsvetelinapasheva

TsvetelinaPasheva/ConditionalStatementsLab/07.ToyShop

Jan 16th, 2021 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp10
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.  
  11.             double holidayPrice = double.Parse(Console.ReadLine());
  12.             int numPuzzle = int.Parse(Console.ReadLine());
  13.             int numDoll = int.Parse(Console.ReadLine());
  14.             int numBears = int.Parse(Console.ReadLine());
  15.             int numMinion = int.Parse(Console.ReadLine());
  16.             int numTrucks = int.Parse(Console.ReadLine());
  17.  
  18.             double totalInCome = numPuzzle * 2.60 + numDoll * 3 + numBears * 4.10 + numMinion * 8.20 + numTrucks * 2;
  19.             int numOfToys = numPuzzle + numDoll + numBears + numMinion + numTrucks;
  20.  
  21.             if (numOfToys >= 50)
  22.             {
  23.                 totalInCome = totalInCome - totalInCome * 0.25;
  24.  
  25.             }
  26.  
  27.             totalInCome -= totalInCome * 0.10;
  28.  
  29.             if (totalInCome >= holidayPrice)
  30.             {
  31.                 Console.WriteLine($"Yes! {totalInCome - holidayPrice:f2} lv left.");
  32.             }
  33.  
  34.             else
  35.             {
  36.                 Console.WriteLine($"Not enough money! {holidayPrice - totalInCome:f2} lv needed.");
  37.             }
  38.  
  39.  
  40.  
  41.  
  42.  
  43.         }
  44.     }
  45. }
Add Comment
Please, Sign In to add comment