SHARE
TWEET

12. Toy Shop

a guest Mar 24th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Toy_Shop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double vacationPrice = double.Parse(Console.ReadLine());
  10.             int puzzlesAmount = int.Parse(Console.ReadLine());
  11.             int dollsAmount = int.Parse(Console.ReadLine());
  12.             int teddyBearsAmount = int.Parse(Console.ReadLine());
  13.             int minionsAmount = int.Parse(Console.ReadLine());
  14.             int trucksAmount = int.Parse(Console.ReadLine());
  15.             double sum = (puzzlesAmount * 2.60) + (dollsAmount * 3)
  16.                 + (teddyBearsAmount * 4.10) + (minionsAmount * 8.20)
  17.                 + (trucksAmount * 2);
  18.             int toysAmount = puzzlesAmount + dollsAmount
  19.                 + teddyBearsAmount + minionsAmount + trucksAmount;
  20.             bool discount = toysAmount >= 50; // Ако играчките са 50 ИЛИ ПОВЕЧЕ
  21.             double discountSum = 0;
  22.             if (discount == true)
  23.             {
  24.                discountSum = sum / 4;
  25.             }
  26.             else
  27.             {
  28.                 discountSum = 0;
  29.             }
  30.             double lastSum = sum - discountSum;
  31.             double rent = lastSum / 10;
  32.             double wonMoney = lastSum - rent;
  33.             if (wonMoney >= vacationPrice) // Ако печалбата е по-голяма или РАВНА на цената на екскурзията
  34.             {
  35.                 Console.WriteLine($"Yes! {wonMoney - vacationPrice:F2} lv left.");
  36.             }
  37.             else if (wonMoney < vacationPrice)
  38.             {
  39.                 Console.WriteLine($"Not enough money! {vacationPrice - wonMoney:F2} lv needed.");
  40.             }
  41.         }
  42.     }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top