JAVA Write a Student class with a String name and double gpa class members. Write a constructor, get and set methods, and a toString method.
public class Student { private String name; private double gpa; public Student(String name, double gpa) { this.name = name; this.gpa = gpa; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getGpa() { return gpa; } public void setGpa(double gpa) { this.gpa = gpa; } public String toString() { return "Student{" + "name='" + name + '\'' + ", gpa=" + gpa + '}'; } }
Get Answers For Free
Most questions answered within 1 hours.