Advertisement
petarkobakov

Bachelor party

Feb 23rd, 2020
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Bachelor_Party
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int honorar = int.Parse(Console.ReadLine());
  10. int sumGuests = 0;
  11. double sumOfReseravtions = 0;
  12. double reservationPrice = 0;
  13. int groupCounter = 0;
  14.  
  15.  
  16. string command = Console.ReadLine();
  17.  
  18. while (command != "The restaurant is full")
  19. {
  20. int peopleCount = int.Parse(command);
  21.  
  22. sumGuests += peopleCount;
  23.  
  24. int people = peopleCount;
  25.  
  26. for (int group = 1; group <= people; group++)
  27. {
  28. groupCounter++;
  29. people -= peopleCount;
  30.  
  31. if (peopleCount < 5)
  32. {
  33. reservationPrice = peopleCount * 100;
  34. sumOfReseravtions += reservationPrice;
  35. }
  36. else if (peopleCount >= 5)
  37. {
  38. reservationPrice = peopleCount * 70;
  39. sumOfReseravtions += reservationPrice;
  40. }
  41. }
  42.  
  43. command = Console.ReadLine();
  44. }
  45.  
  46. double budget = sumOfReseravtions-honorar;
  47.  
  48. if (sumOfReseravtions >= honorar)
  49. {
  50. Console.WriteLine($"You have {sumGuests} guests and {budget} leva left.");
  51. }
  52. else
  53. {
  54. Console.WriteLine($"You have {sumGuests} and {sumOfReseravtions} leva income, but no singer.");
  55. }
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement