Question: Class rosters include primary information of students. In this task you will learn how to use ADT Bag to implement a class roster with unspecified
Class rosters include primary information of students. In this task you will learn how to use ADT Bag to implement a class roster with unspecified size. Step 1: Use a resizable array to implement ADT Bag and write a java program to let the user add, drop and search for a specific student using student ID (Duplication is not allowed). Your program should also provide the user with the following options: Class size If class is full or empty The number of students in the same academic level. o In your program, define a java class called Student with the following data fields: Student ID, first_name, last_name and academic level with: int , String, String and String data types respectively. Note that academic level can be: freshman, sophomore, junior or senior only. Step 2: Repeat step 1, but use a chain of linked nodes instead of a resizable array.
I have the implementation down with BagInterface.java and Student.java
I need help with the driver program to implement them. Not sure how I am supposed to allow the user to be able to search for the Student's ID or Name to remove them from the class. Thanks..
BagInterface.java
public interface BagInterface
Student.java
public class Student { private int Student_ID; private String first_name; private String last_name; private String academic_level; public Student() { Student_ID = 0; first_name = "n/a"; last_name = "n/a"; academic_level = "n/a"; } public Student(int ID, String first, String last, String year) { Student_ID = ID; first_name = first; last_name = last; academic_level = year; } // end of my constructor w/ parameters for student, mutators public void setID(int ID) { Student_ID = ID; }
public void setFirstName(String first) { first_name = first; }
public void setLastName(String last) { last_name = last; }
public void setAcademicYear(String year) { academic_level = year; } //my defined accessor methods public int getID() { return Student_ID; }
public String getFirstName() { return first_name; }
public String getLastName() { return last_name; }
public String getAcademicYear() { return academic_level; }
@Override public String toString() { return Student_ID + ", " + first_name + ", " + last_name + ", " + academic_level; } //end toString
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
