Question: Help on this Java Question. It NEEDS a Test Program PROGRAM1 Implement a class called Student. A student has a first name and a last
Help on this Java Question. It NEEDS a Test Program
PROGRAM1 Implement a class called Student. A student has a first name and a last name . A student has an address A student has a grade point average GPA A student has a unique student number that is given by the system' A student has a login id that can be obtained (you do not need to check for uniqueness of the login id - just follow the rules below on assigning the login id) . Supply appropriate constructors and public methods for the Student class. Provide the following methods . . . getName getAddress addCourse calculate GPA getStudentNum getLoginld Implement a test program for the class Student. As stated in $2.7 on page 53, The purpose of a test program is to verify that one or more methods have been implemented correctly. A test program calls methods and checks that they return the expected results." So, instead of writing a separate test plan as you did for the first assignment, incorporate the test plan into the main method or more likely, into methods called from the main method of your "StudentTester" class. Or read data into the main method (or into a method called by the main method) from standard input and get the data from a file using 'file redirection'. This main method can (and should) call other methods to test the various methods of the Student class. As recommended in the textbook, think through the expected results. Consult also section $3.4 in the textbook on "Unit Testing". ABOUT YOUR IMPLEMENTATION: Comment your classes and methods appropriately using the Javadoc notation. . Every time that a course is added, the grade point value earned (i.e. the grade points) for that course must be passed as an argument as well as the number of credit units for the course. You do not need to keep track of which courses have been taken by the student. "The Grade Point Average GPA is calculated by taking the grade points a student earned in a given period of time divided by the total number of credits taken." (Wikipedia) Use as "weights" for the grade points the credit units. . One of the constructors needs to takes two strings as arguments. One string will be the student address (which may contain blanks and is free formatted). The other argument is the student name. Assume that every student name consists of exactly two words: the first word is the "first name" and the second word is the "last name" (we are not allowing so-called "middle names" ... sorry to those of you from countries that have several last names too). There can be blanks in the argument of the student name: remove the extra blanks before and after the first and last name. . The "student number" assigned to the first student created should be 7777. Every new student will have a unique "student number" which is one more than the last assigned "student number". . Do provide a no-argument constructor. Make a design decision as to how you are initializing internal values in the no-argument constructor and if needed, justify your decision as a comment in the code. O "Compute" the login-id as follows (all the letters of the login-id are in lower case): Make the first letter of the 'login id' the first letter of the "first name" (and remember that the "first name" is the first word of the student name, normalized to remove extra blanks). o Make the middle part of the 'login id' the first 3 letters of the "last name" if the "last name" has fewer than 3 letters, then use all the letters of the "last name" Make the last part of the 'login id' the digital root of the student number Examples "April Schauer" with a 'student number' 7777 has a 'login id' asch1 "Norma Li with a 'student number' 10786 has a 'login id' nli 4 Misty Waters" with a 'student number' 9679 has a 'login id' mwat4 "Brock o" with a 'student number' 8000 has a 'login id' bo8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
