Question: Write a java method to remove all Students who have not paid their tuition from a hash table. Students are hashed by their id. The

Write a java method to remove all Students who have not paid their tuition from a hash table. Students are hashed by their id.

The method header is: public void dropUnpaidStudents(HashMap map)

public class Student {

private String firstName, lastName;

private boolean tuitionPaid;

private double gpa;

public Student(String firstName, String lastName, boolean tuitionPaid, double gpa) {

this.firstName = firstName;

this.lastName = lastName;

this.tuitionPaid = tuitionPaid;

this.gpa = gpa;

}

public String getFirstName() {

return firstName;

}

public void setFirstName(String firstName) {

this.firstName = firstName;

}

public String getLastName() {

return lastName;

}

public void setLastName(String lastName) {

this.lastName = lastName;

}

public boolean isTuitionPaid() {

return tuitionPaid;

}

public void setTuitionPaid(boolean tuitionPaid) {

this.tuitionPaid = tuitionPaid;

}

public double getGpa() {

return gpa;

}

public void setGpa(double gpa) {

if(gpa >= 0 && gpa <= 4) {

this.gpa = gpa;

}

}

@Override

public String toString() {

return firstName + " " + lastName +

" \tTuition Paid: " + tuitionPaid +

" \tGPA: " + gpa;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!