nikolayneykov

Untitled

Nov 15th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Exam_Bachelor_Party
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double money = double.Parse(Console.ReadLine());
  14.  
  15.             string command = String.Empty;
  16.             double couvert = 0;
  17.             double sum = 0;
  18.             int guests = 0;
  19.  
  20.             while ((command = Console.ReadLine()) != "The restaurant is full")
  21.             {
  22.                 int group = int.Parse(command);
  23.                 if (group < 5)
  24.                 {
  25.                     couvert = group * 100;
  26.                 }
  27.                 else
  28.                 {
  29.                     couvert = group * 70;
  30.                 }
  31.                 guests += group;
  32.                 sum += couvert;
  33.             }
  34.  
  35.             if (sum >= money)
  36.             {
  37.                 Console.WriteLine($"You have {guests} guests and {sum - money} leva left.");
  38.             }
  39.             else if (sum < money)
  40.             {
  41.                 Console.WriteLine($"You have {guests} guests and {sum} leva income, but no singer.");
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment