Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace WeddingDecoration
- {
- class Program
- {
- static void Main(string[] args)
- {
- double balloonPrice = 0.1;
- double flowerPrice = 1.5;
- double candlePrice = 0.5;
- double ribbonPrice = 2.0;
- int balloonsCount = 0;
- int ribbonCount = 0;
- int flowersCount = 0;
- int candlesCount = 0;
- double spendMoney = 0;
- double budget = double.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- while (input != "stop")
- {
- int decorationAmount = int.Parse(Console.ReadLine());
- if (input == "balloons")
- {
- balloonsCount += decorationAmount;
- spendMoney += balloonPrice * decorationAmount;
- }
- else if (input == "ribbon")
- {
- ribbonCount += decorationAmount;
- spendMoney += ribbonPrice * decorationAmount;
- }
- else if (input == "flowers")
- {
- flowersCount += decorationAmount;
- spendMoney += flowerPrice * decorationAmount;
- }
- else if (input == "candles")
- {
- candlesCount += decorationAmount;
- spendMoney += candlePrice * decorationAmount;
- }
- if (spendMoney >= budget)
- {
- Console.WriteLine("All money is spent!");
- break;
- }
- input = Console.ReadLine();
- }
- if (input == "stop")
- {
- Console.WriteLine($"Spend money: {spendMoney:f2}");
- Console.WriteLine($"Money left: {(budget - spendMoney):f2}");
- }
- Console.WriteLine($"Purchased decoration is {balloonsCount} balloons, {ribbonCount} m ribbon, {flowersCount} flowers and {candlesCount} candles.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement