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 4 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 1 and 4 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 1 and 3, and the last student from lines 2 and 4.
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 N, which specifies the number of students to follow. The following
N lines of input each contain a student's name as well as the number they drew.
Take the following input as an example:
8
Quinton 3
Zoey 1
Graham 1
Justice 4
Ruby 2
Greg 4
Lamar 3
Steven 2
The first line "8" 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 3, Zoey
drew the number 1, Graham drew the number 1, and so on.
Note: There will always be enough students to form groups of 4 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.
( Making Groups ) Each week, your Computer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!