The goal of this assignment is to demonstrate your knowledge of Java classes. You will do this by writing three Java classes, that will contain constructors, accessor methods, and mutator methods. You will also write another Java class that has a main method that will test your classes.
You will write a Java class, Student, that represents a student at the university. The Student should have the following private attributes:
You will define the class Address that represents the mailing address of the student. The Address should have the following private attributes:
You will define the class Grade that represents a single entry on a transcript. The Grade should have the following private attributes:
For ALL Classes
You will write the appropriate accessor and mutator methods for all attributes in all classes as well as default and copy constructors. You may wish to add other constructors for convenience of testing, but see the test file for what constructors are required. All classes will also need to override the .toString() method which will list the information of the class in the same format as the sample below:
First Name: Joe
Last Name: Bruin
Student ID: 12345678
Address: 1234 Campus Dr.
Los Angeles, CA 90095
ICS 31: 3.7 - 4
ICS 6B: 4.0 - 4
ICS 32: 3.0 - 4
Units: 12
GPA: 3.5666666667
Formatting Notes: It is important to have the same spacing, and capitalization as the sample, or your code will not pass automation). There is a space after every ":", and a space before and after the "-".
You will also write the following three methods in the class Student:
A method that will allow grades to be inserted/added. The method header will look like:
@param String description is the course title or description
@param double gradePoints is the point value of their grade (A: 4.0, A-: 3.7, B+: 3.3, B: 3.0, B-: 2.7, etc.)
@param int units is the number of units the course was worth
public void addGrade( String description, double gradePoints, int units )
A method that calculates how many units the student has. The method header will look like:
public int getUnits()
A method that calculates the GPA of the student. The method header will look like:
public double getGPA()
Please be sure to test your java files using JUnit, and my test file. This will ensure that your class and methods are named correctly, and that the methods have some level of functionality. If your code passes my test file, this simply ensures you will have no compiler errors when your file is run through automation, and does not guarantee full credit for this assignment. You need to perform your own rigorous testing to ensure your logic is accurate for all allowable scenarios.