Question: Create an abstract class called Person that includes private data fields for lastname, firstname, and age. It should include all necessary methods to retrieve the
Create an abstract class called Person that includes private data fields for lastname, firstname, and age. It should include all necessary methods to retrieve the data (no set methods) and a constructor that can set the data fields at the time of instantiation of an object. It also includes an abstract method for displaying information.
Create a subclass called OlympicAthlete that inherits from the Person base class and includes an additional data field for Number of Gold Medals. Implement all the required methods to retrieve the data and a constructor that can initialize the data field at the time of instantiation of the object.
Instantiate an object using the OlympicAthlete class and pass all the data items through the constructor. Display all the information to the console.
Using Java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
