Question: ( Making Groups ) Each week, your Computer Science class splits into groups of 4 for activities. However, to prevent the same groups from forming
Making Groups Each week, your Computer Science class splits into groups of for activities.
However, to prevent the same groups from forming every week, the instructor devised the
following strategy for creating groups randomly:
Each student draws a number between and from a hat.
Each student goes to one of four lines, corresponding to the number they drew.
Once all numbers have been drawn, each group is formed by taking the first student
from lines and and the last student from lines and
Whenever a student is added to a group, they are removed from their line.
Your job is to write a program that takes a list of students and the number they drew as input, and
outputs the resulting groups.
Input Format:
Input starts with a single integer which specifies the number of students to follow. The following
lines of input each contain a student's name as well as the number they drew.
Take the following input as an example:
Quinton
Zoey
Graham
Justice
Ruby
Greg
Lamar
Steven
The first line indicates that there are eight students in the class. The following eight lines
specify the name of the student and the number they drew. Quinton drew the number Zoey
drew the number Graham drew the number and so on
Note: There will always be enough students to form groups of without having any left over.
Output
Print each group that was generated from the input to the console. Groups should be printed in
ascending order, and each student within the group should be in ascending order based on the
number they drew
Note: In this question, you are required to utilize the StringLinkedList class as a library. This
means you must modify the IntLinkedList class library according to the requirements of this
question.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
