Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview of files provided Student class which holds a students information. SNode class represents the node object to be used in the linked structures. It

Overview of files provided

Student class which holds a students information.

SNode class represents the node object to be used in the linked structures. It contains a reference to a Student object and a reference to the next node in the list.

Classroom class holds all of the methods to be written and that will be tested when running the game. Edit the empty methods with you solution, but DO NOT edit the provided ones or the methods signatures of any method. This is the file you submit.

Driver class, which is used to test your methods interactively. The classroom state will be printed after every method is used. Feel free to edit this file, as it is provided only to help you test your code. It is not submitted and it is not used to grade your code.

StdRandom class contains the StdRandom.uniform(n) method that you will use in the method that plays the musical chairs game.

StdIn and StdOut, which are used by the driver. Do not edit these classes..

Multiple text files. Feel free to edit them or even make new ones to help test your code. They are not submitted.

Files containing student information.

Files containing seat location in the classroom.

Classroom.java

DO NOT add new import statements.

DO NOT change any of the methods signatures.

You are encouraged to write helper methods as you see fit. Just make sure that they are private.

The class contains:

studentInLine which refers to the first student in the singly linked list.

musicalChairs which refers to the LAST student in the circularly linked list when the game is being played.

seatingLocation which is a 2D boolean array that shows which seats exist for students to seat at.

studentsSitting which is a 2D Student array that contains the students when they are sitting.

NOTE: seatingLocation and studentsSitting are parallel arrays meaning that seatingLocation[i][j] also refers to the same seat in studentsSitting[i][j]

provided methods that are used by the driver and empty methods you are expected to write your code in.

the printClassroom() function can be used to show the state of the classroom (eg. the states of students in line, seating, and musical chairs) at any time in your code.

4. insertMusicalChairs : This method represents students preparing to start musical chairs! Assume that the students are in studentsSitting. Imagine this as a circle of chairs. This method will take students from the studentsSitting array and add them to the musicalChairs circular linked list. Students are to be inserted at the end of the linked list by traversing row-wise, then column-wise in the studentsSitting array. REMEMBER: the pointer to a circular linked list points to the LAST item in the list, and that item points to the front. NOTES At the end of this method studentsInLine and studentsSitting have no students. This method depends on the previous methods from parts 1, 2, and 3. Test those before testing insertMusicalChairs

I just can't figure out what to do any help is greatly appreciated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

What are the purposes of a statement of cash flows?

Answered: 1 week ago