Create a class called Student (Student.java). It should have the following private data members: String name int ID double GPA Provide the following methods: default constructor (set name to an empty string, and set ID and GPA to 0) non-default constructor Student(string name, int ID, double GPA) getters and setters for the three data members method print() prints the Student object’s information,
Create a class called Student (Student.java). It should have the following private data members:
String name
int ID
double GPA
Provide the following methods:
default constructor (set name to an empty string, and set ID and GPA to 0)
non-default constructor Student(string name, int ID, double GPA)
getters and setters for the three data members
method print() prints the Student object’s information, formatted as follows:
Name: John Smith
ID: 1234
GPA: 3.00
public class Student {
// private data members
// public interface (see methods above)
}
Complete the following unit test for the class Student described above. Make sure to test each public constructor and each public method, print the expected and actual results.
// Start of the unit test of class Student
public class StudentTester {
public static void main()
{
// create 2 objects, one with default constructor,
// and the other with non-default constructor
// test setter methods
// print expected results and
// print actual results using getter methods
// test print method
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps