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 budget = double.Parse(Console.ReadLine());
- double baloons = 0.1;
- double flowers = 1.5;
- double candles = 0.5;
- double ribbon = 2;
- double currentMoneyCount = budget;
- int baloonCount = 0;
- int flowerCount = 0;
- int candleCount = 0;
- int ribbonCount = 0;
- bool stop = false;
- while (currentMoneyCount > 0)
- {
- double orderSum = 0;
- int orders = int.Parse(Console.ReadLine());
- string stockType = Console.ReadLine();
- if (stockType == "balloons")
- {
- orderSum = orders * baloons;
- baloonCount += orders;
- }
- else if (stockType == "flowers")
- {
- orderSum = orders * flowers;
- flowerCount += orders;
- }
- else if (stockType == "candles")
- {
- orderSum = orders * candles;
- candleCount += orders;
- }
- else if (stockType == "ribbon")
- {
- orderSum = orders * ribbon;
- ribbonCount += orders;
- }
- else if (stockType == "stop")
- {
- stop = true;
- break;
- }
- currentMoneyCount -= orderSum;
- }
- if (stop)
- {
- Console.WriteLine($"Spend money: {budget - currentMoneyCount}");
- Console.WriteLine($"Money left: {currentMoneyCount:f2}");
- Console.WriteLine($"Purchased decoration is {baloonCount} balloons, {ribbonCount} m ribbon, {flowerCount} flowers and {candleCount} candles.");
- }
- else
- {
- Console.WriteLine("All money is spent!");
- Console.WriteLine($"Purchased decoration is {baloonCount} balloons, {ribbonCount} m ribbon, {flowerCount} flowers and {candleCount} candles.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement