Question: Name your project either Student_FirstName_LastName or Lab4_FirstName_LastName. This project will consist of three classes: Person, Student, and Tester. Remember to include a documentation comment summarizing

Name your project either Student_FirstName_LastName or Lab4_FirstName_LastName. This project will consist of three classes: Person, Student, and Tester. Remember to include a documentation comment summarizing the program in the Tester class.

The Person class has a single String field for the name of the person. The constructor is used to initialize this name field. There should also be a setter and getter method for the name field. Lastly, the Person class has a custom toString method that prints the following, assuming a name of John Adams:

This persons name is John Adams.

The Student class inherits from the Person class. In addition to the name field that this class will inherit from Person, there is also an int field for a student ID. When a new Student object is constructed, a name should be passed into the constructor and then passed up to the superclasss constructor. Additionally, within the Student constructor, generate a random 8 digit number for a student ID. This means the number must be within the range of 10000000 to 99999999. There should also be a getter for the student ID but no setter. Lastly, the Student class has a custom toString method that prints the following, again assuming a name of John Adams:

John Adams student ID is [student ID].

The student ID field will be whatever random int is generated during construction of the object. Keep in mind that depending on your approach to implementing these classes, you cannot necessarily access the name of the student directly.

In the main method of the Tester class, construct one object each for the Person and Student class and then print these two objects to the console. You may give these objects any names you prefer. As a sample output for this Tester:

This persons name is Elvis Presley

Elvis Presleys student ID is 12345678.

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!