I have to implement the code with teacher comments

Nov 10th, 2014
Price: $10 USD

Question description

public class CourseRoster {

//Do NOT add or remove any of these data members

private String courseName;

private String instructorName;

private Student[] roster;

public CourseRoster(){

//Constructs a CourseRoster

// DO NOT modify this method

courseName = "CMSC 131";

instructorName = "Tom R";

roster = null;


public void addStudent(Student newMember){

//adds a new item always to the end of the list

// This one is already implemented for you

//Do NOT modify this method

if (roster == null){

roster = new Student[1];

roster[0] = new Student(newMember);


Student[] tempStudentArr = 

new Student[roster.length+1];

for (int index = 0; index < roster.length; index++){

tempStudentArr[index] = roster[index];


tempStudentArr[roster.length] = new Student(newMember);

roster = tempStudentArr;



public String getNames(){

// returns the list of student names concatenated together

// it will be used in the junit tests to determine if students

// were added in the correct order

// This one is already implemented for you

// Do NOT modify this method

if (roster == null){

return null;


String list="";

for (int index = 0; index < roster.length;index++){



return list;



public int getSize(){

//returns the current size of the roster array

//This one is already implemented for you

// Do NOT modify this method

if (roster == null){

return 0;


return roster.length;



public int findIndex(String name){

// returns the index for the first occurrence of a Student

// in the roster whose name matches that value of the parameter

// or returns -1 if that name is not in the list

return -1;


public int getValues(){

//returns the sum of all values of the individual

// items in the current array based on the 

// object's getValue method

// if the list is empty, the value 0 is returned

return -1;


public int giveMoreAid(){

// gives a raise in financial aid to each member of the list

// each according to its giveMoreAid method

// returns the sum of the return values

// of all of the calls to the giveMoreAid methods

// if the list is empty, the value 0 is returned

return -1;


public boolean removeStudent(String name){

// Removes the first student whose name matches

// the value of the parameter and returns true- if a student 

// with that name appears in the roster.

// Returns false - if that name does not appear

// in the current roster and does not remove anything.

// If a student is removed from the roster,  the roster array

// must remain the exact size needed to hold the number 

// of Students currently in the class (the size of the array itself

// must be one smaller if there is one fewer elements in the list.

// If the one being removed is the only student in the list, the

// roster should become null (as it was set in the constructor).

return false;



Tutor Answer

(Top Tutor) Syedali A
School: University of Maryland

Studypool has helped 1,244,100 students

Review from student
" Outstanding Job!!!! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1820 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