Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FlowerShop
- {
- class Program
- {
- static void Main(string[] args)
- {
- // • Брой магнолии – цяло число в интервала[0 … 50]
- //• Брой зюмбюли – цяло число в интервала[0 … 50]
- //• Брой рози – цяло число в интервала[0 … 50]
- //• Брой кактуси – цяло число в интервала[0 … 50]
- //• Цена на подаръка – реално число в интервала[0.00 … 500.00]
- int countOfMagnoliq = int.Parse(Console.ReadLine());
- int countOfZiubuil = int.Parse(Console.ReadLine());
- int countOfRoses = int.Parse(Console.ReadLine());
- int countOfCactuses = int.Parse(Console.ReadLine());
- double priceOfPresent = double.Parse(Console.ReadLine());
- double singleMagnoliqPrice = 3.25;
- double singleZiumbiulPrice = 4.0;
- double singleRosePrice = 3.5;
- double singleCactusPrice = 8.0;
- double incomeFromFlowers = (countOfMagnoliq * singleMagnoliqPrice) +
- (countOfZiubuil * singleZiumbiulPrice) +
- (countOfRoses * singleRosePrice) +
- (countOfCactuses * singleCactusPrice);
- double totalIncome = incomeFromFlowers * 0.95;
- string result = string.Empty;
- if (totalIncome >= priceOfPresent)
- {
- //TODO print output
- double moneyLeft = Math.Floor(totalIncome - priceOfPresent);
- result = $"She is left with {moneyLeft} leva.";
- }
- else if (totalIncome < priceOfPresent)
- {
- //TODO print the other output
- double moneyNeeded = Math.Ceiling(priceOfPresent - totalIncome);
- result = $"She will have to borrow {moneyNeeded} leva.";
- }
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement