Advertisement
simonradev

Second

Apr 30th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace FlowerShop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //            •   Брой магнолии – цяло число в интервала[0 … 50]
  14.             //•   Брой зюмбюли – цяло число в интервала[0 … 50]
  15.             //•   Брой рози – цяло число в интервала[0 … 50]
  16.             //•   Брой кактуси – цяло число в интервала[0 … 50]
  17.             //•   Цена на подаръка – реално число в интервала[0.00 … 500.00]
  18.  
  19.             int countOfMagnoliq = int.Parse(Console.ReadLine());
  20.             int countOfZiubuil = int.Parse(Console.ReadLine());
  21.             int countOfRoses = int.Parse(Console.ReadLine());
  22.             int countOfCactuses = int.Parse(Console.ReadLine());
  23.             double priceOfPresent = double.Parse(Console.ReadLine());
  24.  
  25.             double singleMagnoliqPrice = 3.25;
  26.             double singleZiumbiulPrice = 4.0;
  27.             double singleRosePrice = 3.5;
  28.             double singleCactusPrice = 8.0;
  29.  
  30.             double incomeFromFlowers = (countOfMagnoliq * singleMagnoliqPrice) +
  31.                                        (countOfZiubuil * singleZiumbiulPrice) +
  32.                                        (countOfRoses * singleRosePrice) +
  33.                                        (countOfCactuses * singleCactusPrice);
  34.  
  35.             double totalIncome = incomeFromFlowers * 0.95;
  36.  
  37.             string result = string.Empty;
  38.             if (totalIncome >= priceOfPresent)
  39.             {
  40.                 //TODO print output
  41.                 double moneyLeft = Math.Floor(totalIncome - priceOfPresent);
  42.  
  43.                 result = $"She is left with {moneyLeft} leva.";
  44.             }
  45.             else if (totalIncome < priceOfPresent)
  46.             {
  47.                 //TODO print the other output
  48.                 double moneyNeeded = Math.Ceiling(priceOfPresent - totalIncome);
  49.  
  50.                 result = $"She will have to borrow {moneyNeeded} leva.";
  51.             }
  52.  
  53.             Console.WriteLine(result);
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement