Student Roster Java Program, computer science homework help

Jun 16th, 2016
Sigchi4life
Category:
Art Design
Price: $5 USD

Question description

I finished the first Student class on BlueJ and it compiles just fine. But I cannot figure out how to make the public Roster extends ArrayList<Student> class.

public class Student
{
private String lName, fName;
private int idNum;

public Student(int id, String fn, String ln)
{
lName = ln;
fName = fn;
idNum = id;
}

public String getLastName()

return lName; 
}

public String getFirstName()

return fName;
}

public int getID()

return idNum;
}

public String toString()

return fName + " " + lName + " " + idNum; 
}
}

The ArrayList<Student> class must have methods:

public boolean contiansStudent(String ln)- given the last name of the student and determines if the student exists in the list.

public Student retrieveById(int id)- given the id, finds student in list and returns the student. If student not found, eturn null.

public int retrieveId(String ln)- given last name of student, return the id for that student.

public boolean addStudent(Student s)- adds the Student s to the list and true or false value that this was accomplished. This method should not allow duplicate students to be added (duplicate meaning same name or id).

public boolean removeStudent(int id)- removes a student from the list based on id.

public boolean removeStudent(String ln)- removes a student from the list based on last name.

public void printRoster()- print all students in the ArrayList<Student> list. 

Help please!! 

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UIUC
PREMIUM TUTOR

Here is your Roster Classimport java.util.ArrayList;public class Roster extends ArrayList<Student> { public ArrayList<Student> students; public Roster() { students=new ArrayList<Student>(); } public boolean contiansStude...

Studypool has helped 1,244,100 students

Summary
Quality
Communication
On Time
Value
darnay
Feb 19th, 2017
" The best tutor out there!!!! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1830 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors