Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ToyStore
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.  
  10.  
  11. //задачата за ваканцията
  12.  
  13.  
  14.             double vacationPrice = double.Parse(Console.ReadLine());
  15.             int puzzles = int.Parse(Console.ReadLine());
  16.             int dolls = int.Parse(Console.ReadLine());
  17.             int bear = int.Parse(Console.ReadLine());
  18.             int minion = int.Parse(Console.ReadLine());
  19.             int trucks = int.Parse(Console.ReadLine());
  20.             double discount = 0;
  21.            
  22.  
  23.             if ( puzzles + dolls + bear + minion + trucks > 50)
  24.             {
  25.                 discount = 0.25;
  26.             }
  27.  
  28.             double dollsPrice = dolls * 3;
  29.             double puzzlesPrice = puzzles * 2.60;
  30.             double bearsPrice = bear * 4.10;
  31.             double minionPrice = minion * 8.20;
  32.             double truckPrice = trucks * 2;
  33.  
  34.             double grossPrice = dollsPrice + puzzlesPrice + bearsPrice + minionPrice + truckPrice;
  35.  
  36.             double discountedPrice = discount * grossPrice;
  37.  
  38.             double finalPriceWithoutRent = grossPrice - discountedPrice;
  39.  
  40.             double finalPrice = finalPriceWithoutRent * 0.90;
  41.  
  42.             if (finalPrice > vacationPrice)
  43.             {
  44.                 Console.WriteLine($"Yes! {finalPrice - vacationPrice:F2} lv left.");
  45.             }
  46.             else
  47.             {
  48.                 Console.WriteLine($"Not enough money! {vacationPrice - finalPrice:F2} lv needed.");
  49.                
  50.             }
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement