Hey you guys, I am finishing my last two assignments in my class and I am having trouble because as you will see, the directions are not as they appear. My class is online so I don't have anyone I can rack my brain to or with and did I mention both my teacher and teacher assistants are out of the country lol.....so maybe you guys will be able to help. Here is the assignment:
Create a Parent class called Student. The Student class shall have attributes name:String (a variable name which is of type String), id:int, classList:ArrayList, gradeList:ArrayList and gpa:double.
Student has two child classes BachelorStudent and MasterStudent. Both classes should have the attribute effectiveGPA:double as well as the method calculateGPA() that returns a double and stores it in the effectiveGPA variable.
For the bachelor class, the method should take all the grades in the gradeList arraylist and average them out (Standard grades, A=4, B=3, C=2, D=1, F=0). For the masters class, the method does the same and then multiplies the result by 0.98.
Write a test driver class to create a bachelor student and a master student. Assign 4 grades in their gradelist variable for each - you can either hardcode this or use input from the screen - your choice.
Once done, calculate and print their GPAs along with their Name and ID and designation (Bachelors or Masters student). Also list out any grades for them that are A and F - do this by using the iteration functionality built in to go through each element in the arraylist and check to see if it is A or F, if so, print it.
Also, in output, first print your name, assignment number, and current date in at least two different format. Not hard coded dates, but current day of the day it is executing.
Attack this assignment one small piece at a time.
First - create the classess.
Second - write the methods for the subclasses
Test out the methods by assigning grades and seeing if they work
Third - study the ArrayList structure to see how iteration through it works.
Write a simple iterator through a test arraylist to see if you can seek out a given value.
Read GregorailCalander class in JAVA API, write simple method which prints current date in two different formats.
After you've nailed all this, put all the pieces together.
Have Fun :)
So so far I have created the parent and child classes and now I am stuck on how to code the calculateGPA() method.... I know that some how I will have to convert the letter grades so that it will know what letter equals what number. I have also declared the attributes so tell me if they look right. Thank you in advance for your help!
public class Student
{
private String string;
private int id;
private String[] classList;
private double gpa;
private double[] gradeList;
private double effectiveGPA;
public double calculateGPA()
{
}
}
public class BachelorStudent extends Student
{
}
public class MasterStudent extends Student
{
}