Question: Homework 2 ( 5 Points ) Write a Java program with the following specifications: Create a superclass named 'Person' with a method 'sayHello ( )

Homework 2(5 Points)
Write a Java program with the following specifications:
Create a superclass named 'Person' with a method 'sayHello()' that prints the statement "Hello, I am a Person."
Define a subclass of 'Person' named 'Worker'.
Define another subclass of 'Person' named 'Athlete'.
Implement a method named 'sayHello()' in both the 'Worker' and 'Athlete' classes.
In the 'sayHello()' method of the 'Worker' class, print the statement "I am a Worker" once.
In the 'sayHello()' method of the 'Athlete' class, print the statement "I am an Athlete" four times.
Ensure that the program demonstrates the usage of these classes by calling the 'sayHello()' method for each class.
 Homework 2(5 Points) Write a Java program with the following specifications:

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!