SvetlanPetrova

Bachelor Party SoftUni

Apr 6th, 2019 (edited)
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1. using System;
  2.  
  3. namespace BachelorParty
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int performerPrice = int.Parse(Console.ReadLine());
  10.             int couvert = 0;
  11.             int revenuePerGroup = 0;
  12.             int totalRevenue = 0;
  13.             int totalGuestsNumber = 0;
  14.             string command = string.Empty;
  15.  
  16.             while (command != "The restaurant is full")
  17.             {  
  18.                 command = Console.ReadLine();
  19.                 if (command == "The restaurant is full")
  20.                 {
  21.                     break;
  22.                 }
  23.                 int guestsNumber = int.Parse(command);
  24.                 totalGuestsNumber += guestsNumber;
  25.                 if (guestsNumber < 5)
  26.                 {
  27.                     couvert = 100;
  28.                 }
  29.                 else if (guestsNumber >= 5)
  30.                 {
  31.                     couvert = 70;
  32.                 }
  33.                 revenuePerGroup = guestsNumber * couvert;
  34.                 totalRevenue += revenuePerGroup;
  35.  
  36.             }
  37.  
  38.             if (totalRevenue >= performerPrice)
  39.             {
  40.                 Console.WriteLine($"You have {totalGuestsNumber} guests and {totalRevenue - performerPrice} leva left.");
  41.             }
  42.             else if (totalRevenue < performerPrice)
  43.             {
  44.                 Console.WriteLine($"You have {totalGuestsNumber} guests and {totalRevenue} leva income, but no singer.");
  45.             }
  46.  
  47.            
  48.         }
  49.     }
  50. }
Add Comment
Please, Sign In to add comment