Question Get Answer

I need help with this program. Part 2: Queues [50 POINTS] 1. Circular Array Implementation of Queues [20 POINTS]


Implement a generic Queue with a Circular Array, see Slide#23&24 of 04-Stack&Queue.pdf for queue specifications. You may need to implement other Queue operation methods to fulfill the application in the next step.

2. Application: Rudimentary Student Enrollment Management [20 POINTS]


Apply your queue implementation to implement a rudimentary student enrollment management system and simulate student registration process. We use two attributes (redID and name) to specify a student. See Data.zip for the Student class which defines the data to be stored in a queue. You need to import Student.java and MyComparable.java files into your project (you may change the package name to fit your package structure). The requirements are as follows:

• The program must be able to read a text file named "Records.txt".

• The contents of the input text file must be a collection of student records of type: name<comma>redID (One record per line). Assume there are NO errors in the records file. The figure below gives a sample input text file.

Chunhui Guuo, 123456789

John Smith, 223456789

Jane Smith, 323456789




The program must be able to read the text file line by line and create both arrays and queues of Student objects.

• The management system program needs to implement the following functionalities (the blue ones are console menu options, see 03-ArrayExample.jar for example):

o Ask the user to enter the number of open seats for their class.

o Create one Enrolled Array (size is the input number of open seats) and one Waiting Queue (you may give a large enough MAX_ITEMS). Note that ONLY the Waiting Queue uses your Queue data structure with its appropriate methods.

o Read the input "Records.txt" file line by line from top to bottom, create Student objects and add to the Enrolled Array until full, add the remaining Student objects to the Waiting Queue.

o Give the user an option to delete a student from the Enrolled Array by redID. You need to implement a linear search algorithm for Arrays.

o Once a student is deleted from the Enrolled Array, dequeue a Student from the Waiting Queue and add the Student to the Enrolled Array.



The program must also be able to display the entire Enrolled Array (you may call the Student.toString() method).


3. Testing and Reporting [10 POINTS]

Test your program with all possible scenarios and REPORT your testing inputs (i.e. contents/screenshots of input "Records.txt" files) and corresponding output results (i.e. screenshots of user interactions with console) in ONE single PDF file.

Your tests MUST cover at least the following two cases:

o When the Waiting Queue is NOT empty, delete a student from the Enrolled Array by redID, and display the Enrolled Array after deletion.

o When the Waiting Queue is empty, delete a student from the Enrolled Array by redID, and display the Enrolled Array after deletion.

Student.java file:

package Data;

public class Student implements MyComparable {

   private String redID;
   private String name;
   
   public Student(String redID, String name) {
      this.redID = redID;
      this.name = name;
   }
   
   public String toString() {
      return "Student RedID: " + redID + "; " + "Name: " + name;
   }
   
   //compare using redID
   public int compareTo(Object obj) {
      return redID.compareTo(((Student) obj).getRedID());
   }

   //public getter/setter methods
   public String getRedID() {
      return redID;
   }
   public void setRedID(String redID) {
      this.redID = redID;
   }

   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   
}

MyComparable.java file:

package Data;

public interface MyComparable {
   int compareTo(Object obj);
}


code in Java Program

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Java Programming tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes