I have this code so far:
//Carolina Dominguez
//Assignment 7
public class Student
{
private String fname;
private String lname;
private String studentId;
private double gpa;
public Student(String studentFname,String studentLname,String stuId,double studentGpa)
{
fname = studentFname;
lname = studentLname;
studentId = stuId;
gpa = studentGpa;
}
public double getGpa()
{
return gpa;
}
public String getStudentId()
{
return studentId;
}
public String getName()
{
String name = lname + ", " + fname;
return name;
}
}
Now I need to create a mutator method that lets the client change the gpa. It must verify the gpa is in the range 0.0 to 4.0 (inclusive). If it is not valid, display an error message indicating the problem and end the program.