Advertisement
finderabc

ToyShop 1

Sep 23rd, 2020
955
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 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.  
  21.             if (toysCount >= 50)
  22.             {
  23.  
  24.  
  25.                 double totalPrice = toysSum * 0.75;
  26.  
  27.                 double totalSum = totalPrice * 0.9;
  28.  
  29.                 double moneyLeft = totalSum - trip;
  30.  
  31.  
  32.  
  33.                 if (totalSum >= trip)
  34.                 {
  35.                     Console.WriteLine($"Yes! {moneyLeft:F2} lv left.");
  36.                 }
  37.                 else if (totalSum < trip)
  38.                 {
  39.                    
  40.                     double moneyLeft2 = trip - totalSum;
  41.                     Console.WriteLine($"Not enough money! {moneyLeft2:F2} lv needed. ");
  42.  
  43.  
  44.                 }
  45.  
  46.             }
  47.  
  48.             else
  49.             {
  50.                 double totalSum2 = toysSum * 0.9;
  51.                 double moneyForH = totalSum2 - trip;
  52.  
  53.                 if (totalSum2 >= trip)
  54.                 {
  55.                     Console.WriteLine($"Yes! {moneyForH:F2} lv left.");
  56.                 }
  57.                 else
  58.                 {
  59.                     double moneyNot = trip - totalSum2;
  60.                     Console.WriteLine($"Not enough money! {moneyNot:F2} lv needed. ");
  61.                 }
  62.  
  63.                 }
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.         }
  91.                
  92.     }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement