Advertisement
Valantina

BachelorParty/Sample Exam

Jun 12th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 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 singerSum = int.Parse(Console.ReadLine());
  10.             int numberPeopleInGroup = 0;
  11.             int reservation = 0;
  12.             int income = 0;
  13.             string command = Console.ReadLine();
  14.             int totalnumberPeopleInGroup = 0;
  15.             while (true)
  16.             {
  17.                 income = reservation + income;
  18.                 if (command == "The restaurant is full" && singerSum <= income)
  19.                 {
  20.                     Console.WriteLine($"You have {totalnumberPeopleInGroup} guests and {income - singerSum} leva left.");
  21.                     break;
  22.                 }
  23.                 else if (command == "The restaurant is full" && singerSum > income)
  24.                 {
  25.                     Console.WriteLine($"You have {totalnumberPeopleInGroup} guests and {income} leva income, but no singer.");
  26.                     break;
  27.                 }
  28.                 else
  29.  
  30.                 {
  31.                     numberPeopleInGroup = int.Parse(command);
  32.                     command = Console.ReadLine();
  33.                     if (numberPeopleInGroup < 5)
  34.                     {
  35.                         reservation = 100 * numberPeopleInGroup;
  36.                     }
  37.                     else if (numberPeopleInGroup >= 5)
  38.                     {
  39.                         reservation = 70 * numberPeopleInGroup;
  40.                     }
  41.                     totalnumberPeopleInGroup += numberPeopleInGroup;
  42.                 }
  43.             }
  44.         }
  45.     }
  46.    
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement