desito07

Toy Shop

Nov 8th, 2022
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConditionalStatements
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double tripCosts = double.Parse(Console.ReadLine());
  10.             int puzzels = 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 puzzelsPrice = puzzels * 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.             int toys = puzzels + dolls + bears + minions + trucks;
  23.             double totalPrice = puzzelsPrice + dollsPrice + bearsPrice + minionsPrice + trucksPrice;
  24.  
  25.             if (toys >= 50)
  26.             {
  27.                 totalPrice -= (totalPrice * 25 / 100.00);
  28.             }
  29.  
  30.             double rent = totalPrice * 0.1;
  31.             double total = totalPrice - rent;
  32.            
  33.  
  34.             if (total > tripCosts)
  35.             {
  36.                 Console.WriteLine($"Yes! {(total - tripCosts):F2} lv left.");
  37.             }
  38.             else
  39.             {
  40.                 Console.WriteLine($"Not enough money! {(tripCosts - total):F2} lv needed.");
  41.             }
  42.         }
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment