Question: 1. Create a new Java Project. 2. Create a class named Horse that contains data fields for the name, color, and year born. Include get

1. Create a new Java Project.

2. Create a class named Horse that contains data fields for the name, color, and year born. Include get and set methods for these fields.

3. Next, create a subclass named RaceHorse, which contains an additional field that holds the number of races in which the horse has competed and additional methods to get and set the new field.

4. Create an application named TestHorse that demonstrates using objects of each class. All data is in TestHorse.

Sample Output:

Old Paint is brown and was born in 2009.

Champion is black and was born in 2011.

Champion has been in 4 races.

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!