Question
in Java with comments throughout: Create an abstract class called Person that includes private data fields for lastname, firstname, and age. It should include all
in Java with comments throughout:
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started