Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace BachelorParty
- {
- using System;
- using System.Collections.Generic;
- class StartUp
- {
- static void Main()
- {
- int artistFee = int.Parse(Console.ReadLine());
- string input = "The restaurant";
- double totalIncome = 0.00;//10345.67
- int totalGuests = 0;
- while(input != "The restaurant is full")
- {
- input = Console.ReadLine();
- int guestsNum;
- bool inputIsNum = int.TryParse(input, out guestsNum);
- if(inputIsNum)
- {
- if(guestsNum < 5)
- {
- totalIncome += guestsNum * 100;
- }
- else
- {
- totalIncome += guestsNum * 70;
- }
- totalGuests += guestsNum;
- }
- else
- {
- if(input == "The restaurant is full")
- {
- break;
- }
- }
- }
- if(totalIncome >= artistFee)
- {
- Console.Write($"You have {totalGuests} guests and {totalIncome - artistFee} leva left.");
- }
- else
- {
- Console.Write("You have {0} guests and {1} leva income, but no singer.", totalGuests, totalIncome);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement