Question: In this assignment I will ask you to write two classes in JAVA that might be part of a student/course management system at a university.

In this assignment I will ask you to write two classes in JAVA that might be part of a student/course management system at a university. Notice that you will also be required to create/use a third class - with a main method - to test these classes.

Class One - Student

Each student at the university is stored as an instance of the Student class. Each instance knows the student's name, idNumber, total credits earned and total grade points earned.

Individual instances respond to the following methods

getName() - returns the String representing the student's full name

changeName() - takes a String as a parameter representing the student's full name (allows for name changes)

getID() - returns the String representing the student's id number (yes, the String)

addCredits() - takes in an int representing how many credits the student has earned. Used at the end of the semester to add credit hours

getCredits() - returns an int representing the number of credit points this student has accumulated

addGradePoints() - takes in a double representing how many new grade points the student has earned. Used at the end of the semester to add grade points

getGradePoints() - returns a double representing the number of grade points this student has accumulated

getGPA() - returns a double representing the student's current GPA (notice this is a calculation)

getStatus() - returns a String indicating whether the student is a freshman, sophomore, junior, or senior given UNI's definition of those terms (notice this is a calculation)

getLoginName() - returns the student's computer lab id name which consists of the first four characters of their name (bonus if you can make it of their last name) concatenated with the first 3 digits of their student ID number.

printInfo() - prints the name and ID number of the student in the format "Ben Schafer (123456)" (without the quotes)

toString() - returns a String with the same name and ID format used in printInfo

Additionally, Student has a single constructor that requires the client code provide the student's full name and ID numbers (as Strings) at construction time. By default, students begin with 0 credit hours and a total grade points of 0.0

For example,

 Student student1 = new Student("name lastname","123456"); 

A UML class diagram for this class would look like

Student

name : String idNumber : String totalCredits : int gradePoints : double
Student(String name, String id) getName() : String changeName(String newVal) getID() : String addCredits(int amount) getCredits() : int addGradePoints(double amount) getGradePoints():double getGPA() : double getStatus() : String getLoginName() : String toString() : String printInfo() 

IN-CLASS DECISIONS

If client code asks a Student object for the GPA before the object has acquired any credits (totalCredits is zero) than the object should print a message and return 0.0.

0-29 means freshman, 30-59 means sophomore, 60-89 means junior, 90+ means senior

Any methods which take in numbers as parameters SHOULD accept negative numbers, but only up to the limit of the current state. For example,

if a student has 12 credits the class should accept addCredits(-4) where the result is 8 credits.

if a student has 12 credits the class should accept addCredits(-12) where the result is 0.

if a student has 12 credits the class should reject addCredits(-13)

by reject I mean completely ignore the request. Make no mathematical change but also print no messages.

For loginname you MAY take the first four characters in the name field regardless of what those characters are.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!