Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi, I just need to get this one method done by Friday night. If anyone could provide some explanation as well it would be very
Hi, I just need to get this one method done by Friday night. If anyone could provide some explanation as well it would be very helpful! Thanks!
Implementation Overview of files provided - Student class which holds a student's 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. - Stdln 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 method's 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. This method simulates students standing in line and coming into the classroom (not leaving the line). To complete this method do: 1. Read a student from the input file. 2. Create a Student object with the information read from file. 3. Create a SNode object that holds the Student object from step 2. 4. Insert the SNode from step 3 to the front of the singularly linked list studentsInLine. You have been provided some input files to test this method (students1.in, students2.in, students3.in, students4.in). The format is as follows: - One line containing an integer representing the number of students in the file (one per line) - Several lines (one for student) containing students first name, last name, and height, space separated Use the Stdln library to read from a file: - StdIn.setFile(filename) opens a file to be read - StdIn. readInt() reads the next integer value from the opened file (weather the value is in the current line or in the next line) - StdIn. readstring() read the next String value from the opened file To read one student do: String firstName = StdIn.readString () ; String lastName = StdIn.readString () ; int height = StdIn.readInt(); The input file has Students in reverse alphabetical order; so at the end of this method the list will have all students in alphabetical order. DO NOT impleme a sorting algorithm, there is no need. - Submit Classroom.java with this method completed under Early Submission to receive extra credit. This is the expected output for students 1 .in Students in Line: M. Brow N. Dyer P. Ferg D. Harb M. Hawk C. Heat J. Keer G. Mata C. McLa M. Modi D. Mont P. Reis W. Ryde N. Schn S. Sink F. Wolf Sitting Students: EPTY Students in Musical Chairs: EUPTY What would you like to do now? 1. Test a new input file 2. Test another method on the same file 3. Quit Enter a numberStep 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