1) Through BlueJ, write if the current number of shoppers is greater than or equal to the number leaving then the number of shoppers is decreased by the number leaving. Otherwise, the following error message must be printed and the number of shoppers present must be set to 0. There is an error in the number of shoppers. Use System.out.println to print the message. 2) The class must define a method called leaving that takes a single integer parameter. This represents the number of shoppers leaving the club at a particular point. You may assume that the parameter's value will always be greater than zero and you do not have to check for that. If the current number of clubbers is greater than or equal to the number leaving then the number of clubbers is decreased by the number leaving. Otherwise, the following error message must be printed and the number of clubbers present must be set to 0. There is an error in the number of shoppers. Use System.out.println to print the error message. 3) The class must define a method called is Space that allows the night club staff to determine whether there is enough capacity for a group to attend. This method must take a single integer parameter representing the size of the group, and return a boolean result. The method must work as follows: If the value of the parameter is less-than or equal-to 0 then the method must return false. This case has priority over those following. If the value of the parameter is less-than or equal-to the space left in the night club (use the capacity and occupancy values in the to work this out) then the method must return true. Otherwise (i.e., if there is not space in the night club for the whole group) then the method must return false. (Note that the method must only return true if there is space for the whole group to attend. This method must not change the state of the BookClub object. In other words, both the current number of occupants and the capacity of the club must be exactly the same after it is called as it was before.)

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter7: Using Methods
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question

1) Through BlueJ, write if the current number of shoppers is greater than or equal to the number leaving then the number of shoppers is decreased by the number leaving. Otherwise, the following error message must be printed and the number of shoppers present must be set to 0. There is an error in the number of shoppers. Use System.out.println to print the message.

2) The class must define a method called leaving that takes a single integer parameter. This represents the number of shoppers leaving the club at a particular point. You may assume that the parameter's value will always be greater than zero and you do not have to check for that. If the current number of clubbers is greater than or equal to the number leaving then the number of clubbers is decreased by the number leaving. Otherwise, the following error message must be printed and the number of clubbers present must be set to 0. There is an error in the number of shoppers. Use System.out.println to print the error message.

3) The class must define a method called is Space that allows the night club staff to determine whether there is enough capacity for a group to attend. This method must take a single integer parameter representing the size of the group, and return a boolean result. The method must work as follows: If the value of the parameter is less-than or equal-to 0 then the method must return false. This case has priority over those following. If the value of the parameter is less-than or equal-to the space left in the night club (use the capacity and occupancy values in the to work this out) then the method must return true. Otherwise (i.e., if there is not space in the night club for the whole group) then the method must return false. (Note that the method must only return true if there is space for the whole group to attend. This method must not change the state of the BookClub object. In other words, both the current number of occupants and the capacity of the club must be exactly the same after it is called as it was before.)

Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,