Advertisement
finderabc

ToyShop

Sep 23rd, 2020
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ToyShop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.            
  10.            
  11.             double trip = double.Parse(Console.ReadLine());
  12.             int puzzels = int.Parse(Console.ReadLine());
  13.             int dolls = int.Parse(Console.ReadLine());
  14.             int bears = int.Parse(Console.ReadLine());
  15.             int minions = int.Parse(Console.ReadLine());
  16.             int trucks = int.Parse(Console.ReadLine());
  17.  
  18.             int toysCount = dolls + puzzels + bears + minions + trucks;
  19.             double toysSum = (puzzels * 2.6) + (dolls * 3) + (bears * 4.1) + (minions * 8.2) + (trucks * 2);
  20.             if (toysCount >= 50)
  21.  
  22.             {
  23.                 double totalPrice = toysSum * 0.75;
  24.                 double totalSum = totalPrice * 0.9;
  25.                 double moneyLeft = totalSum - trip;
  26.                 double moneyNot = trip - totalSum;
  27.  
  28.                 if (totalSum >= trip)
  29.  
  30.  
  31.                 {
  32.                     Console.WriteLine($"Yes! {moneyLeft:F2} lv left.");
  33.                 }
  34.  
  35.  
  36.                 else
  37.  
  38.                 {
  39.                     Console.WriteLine($"Not enought money! {moneyNot:F2} lv needed. ");
  40.                 }
  41.                
  42.  
  43.  
  44.  
  45.  
  46.             }
  47.                
  48.  
  49.  
  50.  
  51.            
  52.            
  53.              
  54.            
  55.            
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement