Question
java program people.txt contains the following data of people in a line. It includes their gender, name, and shirt color male Brice Red female Karina
java program
people.txt contains the following data of people in a line. It includes their gender, name, and shirt color
male Brice Red
female Karina Blue
female Lucy Red
male Eldon Green
male Joshua Yellow
female Debra Blue
male Corbin Red
female Brianne Purple
female Adele Blue
male Aster Red
male Monty Green
female Leona Green
female Kathy Purple
female Chloe Red
male Ben Yellow
female Mary Blue
male Mike Green
female Sallie Green
Queues will be used to organize the people in a line three at a time. As one person has left a queue they are added to a fourth queue which is outputted at the end.
An object oriented java program should read the data from people.txt and store it in a data structure. Data should be read line by line and a random number generator is used to select one of three queues to put a person in. As data is read, the random number generator selects 1, 2, or 3 corresponding to the queue the person is placed in.
Program must:be capable of:
- Dequeuing a person from a queue and enqueuing them into the fourth queue
- Continue to dequeue people until all three queues have become empty
- Asking user for range of how many people from each queue can be allowed to get in line, before switching to another queue to let the group leave. (only ask once)
- Order of which queue goes is (queue 1, queue 2, queue 3)
- Users range input generates a random number to dequeue that amount of people from a queue and repeat of the next queue and so on. (do not remove same number from each queue during iteration.)
- Print fourth queues data when the dequeuing from other queues is done
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started