alexbancheva

Bachelor Party

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