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 Exam_Wedding_Decoration
- {
- class Program
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- double ribbon = 0;
- double balloons = 0;
- double flowers = 0;
- double candles = 0;
- string stock = string.Empty;
- double spendMoney = 0;
- while (budget > spendMoney && (stock = Console.ReadLine()) != "stop")
- {
- double quantity = double.Parse(Console.ReadLine());
- double currentPrice = 0;
- switch (stock)
- {
- case "flowers": currentPrice = quantity * 1.5; flowers += quantity; break;
- case "balloons": currentPrice = quantity * 0.1; balloons += quantity; break;
- case "ribbon": currentPrice = quantity * 2; ribbon += quantity; break;
- case "candles": currentPrice = quantity * 0.5; candles += quantity; break;
- }
- spendMoney += currentPrice;
- }
- Console.WriteLine(budget <= spendMoney ?
- "All money is spent!" :
- $"Spend money: {spendMoney:F2}\nMoney left: {budget - spendMoney:F2}");
- Console.WriteLine("Purchased decoration is " +
- $"{balloons} balloons, {ribbon} m ribbon, {flowers} flowers and {candles} candles.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment