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 _04.Wedding_Decoration
- {
- class Program
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- double spendMoney = 0;
- int Bcount = 0;
- int Fcount = 0;
- int Ccount = 0;
- int Rcount = 0;
- while (true)
- {
- string stokTipe = Console.ReadLine();
- if (stokTipe=="stop")
- {
- break;
- }
- int count = int.Parse(Console.ReadLine());
- switch (stokTipe)
- {
- case "balloons":
- spendMoney = spendMoney + (count * 0.1);
- Bcount += count;
- break;
- case "flowers":
- spendMoney = spendMoney + (count * 1.5);
- Fcount += count;
- break;
- case "candles":
- spendMoney = spendMoney + (count * 0.5);
- Ccount += count;
- break;
- case "ribbon":
- spendMoney = spendMoney + (count * 2.0);
- Rcount += count;
- break;
- }
- }
- if (budget > spendMoney)
- {
- Console.WriteLine($"Spend money: {spendMoney:f2}");
- Console.WriteLine($"Money left: {budget - spendMoney:f2}");
- Console.WriteLine($"Purchased decoration is {Bcount} balloons, {Rcount} m ribbon, {Fcount} flowers and {Ccount} candles.");
- }
- else
- {
- Console.WriteLine("All money is spent!");
- Console.WriteLine($"Purchased decoration is {Bcount} balloons, {Rcount} m ribbon, {Fcount} flowers and {Ccount} candles.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement