As the new manager of Club Ruby, you been tasked with creating an automated bouncing system.
The club's rules state:
- Only people 18 and over are allowed in the door
- No more than 8 people should be inside the club at any time
Using what you know about loops and collections in Ruby, write a script that when given an array of people waiting outside the club...:
- Creates a new array of people inside the club
- Allows the appropriate people into the club
- Stops once 8 people have been admitted
Some sample people have been provided for you in script.rb
.
- How could you use
next
andbreak
to alter the behavior of a loop?
- Determine whether or not a person can be served alcohol (that is: whether they're 21 or over)
- Create a new key/value pair for each
person
withserved
as a boolean - Create an array for all people rejected from the club for being too young to enter