# x.øi5 A company has six hiring positions with more people wanting jobs than the number of available.

x.øi5

A company has six hiring positions with more people wanting jobs than the number of available positions. The company managers decide in order to give morepeople an opportunity to make money; they will allow people to work in three-month intervals. The first six people on the waiting list will be hired in the orderthat they are on the waiting list. The first six people will keep these positions for three months. At the end of three months, the manager will roll adice to determine the number of people who will lose their jobs. The company will use the policy of last-hired-first-fired. For example, if the dice roll is3, the last 3 people hired will lose their jobs to the first 3 people on the waiting list. People losing their jobs will be placed on the back of the waiting listin the order that they are fired. This process will continue for every three-month interval.

Write a program to simulate this process. Use the following guidelines.

– Use a stack to represent the list of workers.

– Use a queue to represent the list of people waiting to work.

– Simulate a manager rolling a dice by randomly generating a number 1 through6. Note: Use the C++ function – rand(). (To use this function you must include the or .)

– At the end of each three-month interval, show who the new worker’s are by theordered that they were hired and the new waiting list.Also show the dice value.

– Ask the user if they want the see the workers and the waiting list at the end ofthe next three months. Program ends if the user does not want to see any more.

Sample input: Ask the user for the number of people needing jobs. This number must be greater than 6. Using that number, randomly generatethe list of ID numbers for the workers. An ID number should be greater than or equal to 100 and less than 1000. Make sure no two workers have the sameID. (Hint: Use the following to generate an ID number: ID = 100 + rand()% 900.)

Sample output:

Initial Waiting list

111

222

333

444

555

666

777

888

999

101

201

301

Current worker’s list

Current Waiting list1st hired 111

2nd hired222

3rd hired 333

4th hired 444

5th hired 555

6th hired 666

777

888

999

101

201

301

End of Three Months

Dice roll: 3

New Worker’s List

New Waiting list1st hired 111

2nd hired222

3rd hired 333

4th hired 777

5th hired 888

6th hired 999

101

201

301

666

555

444

End of Three Months

Dice roll: 2

New Worker’s List

New Waiting List1st hired 111

2nd hired222

3rd hired 333

4th hired 777

5th hired 101

6th hired 201

301õ66x.øi5

555

444

999

888

End of Three Months

Dice roll: 6

New Worker’s List

New Waiting List

1st hired 301šu x.øi5pan>2nd hired666