Advertisement
nevenailievaa

04.ToyShop

Oct 15th, 2022
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 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.             //Input
  10.             double tripPrice = double.Parse(Console.ReadLine());
  11.             int puzzlesCnt = int.Parse(Console.ReadLine());
  12.             int dollsCnt = int.Parse(Console.ReadLine());
  13.             int bearsCnt = int.Parse(Console.ReadLine());
  14.             int minionsCnt = int.Parse(Console.ReadLine());
  15.             int trucksCnt = int.Parse(Console.ReadLine());
  16.  
  17.             //Actions
  18.             double puzzlesPrice = puzzlesCnt * 2.60;
  19.             double dollsPrice = dollsCnt * 3;
  20.             double bearsPrice = bearsCnt * 4.10;
  21.             double minionsPrice = minionsCnt * 8.20;
  22.             double trucksPrice = trucksCnt * 2;
  23.  
  24.             int allToysCnt = puzzlesCnt + dollsCnt + bearsCnt + minionsCnt + trucksCnt;
  25.  
  26.             double totalPrice = puzzlesPrice + dollsPrice + bearsPrice +
  27.             minionsPrice + trucksPrice;
  28.  
  29.             if (allToysCnt >= 50)
  30.             {
  31.                 totalPrice = totalPrice - (totalPrice * 0.25);
  32.             }
  33.  
  34.             double rent = 0.10 * totalPrice;
  35.             totalPrice -= rent;
  36.  
  37.             //Output
  38.             if (totalPrice >= tripPrice)
  39.             {
  40.                 Console.WriteLine($"Yes! {(totalPrice-tripPrice):f2} lv left.");
  41.             }
  42.             else
  43.             {
  44.                 Console.WriteLine($"Not enough money! {(tripPrice-totalPrice):f2} lv needed.");
  45.             }
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement