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