Question: How will you program with java puter Scie New Tab room google.com/u/0/e/MTO NDgxODRa ttled documentM Intemships-Northr Race Horse Inheritance Inheritance -Rules to Remember 1. A

 How will you program with java puter Scie New Tab room

google.com/u/0/e/MTO NDgxODRa ttled documentM Intemships-Northr Race Horse Inheritance Inheritance -Rules to Remember

How will you program with java

puter Scie New Tab room google.com/u/0/e/MTO NDgxODRa ttled documentM Intemships-Northr Race Horse Inheritance Inheritance -Rules to Remember 1. A subclass can add new private instance variables. 2. A subclass can add new public or private methods. 3. A subclass can override (redefine) inherited methods. 4. A subclass must define its own constructors 5. A subclass cannot access the private members of its superclass Description A Horse class is defined with the following attributes and behaviors: Attributes (instance variables) . name the name of the horse . owner the owner of the horse . value how much the horse is worth Behaviors (methods) toString returns a string representation of the values stored in a horse object's instance variabies. Define a RaceHorse class with all of the attributes of the Horse class but with an additional attribute for the number of races a horse has won. Since a race horse is-a a type of horse this relationship can be represented Horse Race Horse Source Code Open and copy the foliowing workspace to your home directory Horse fications Make the following additions and modifications to the Racetorse class: 1. A subclass can add new private instance variables . Add an instance variable of type int named numRacesWon 2. A subclass can add new public or private methods 3 You Have A 4: B AP Computer Scie x New Tab tps/ dlassroom google.com/u//c/MTOSOTYINDgxoDRa s Untified document Internships Ne Source Code Open and copy the following workspace to your home directory Horse Make the following additions and modifications to the RaceHorse class 1. A subclass can add new private instance variables . Add an instance variable of type int named numRacesWon 2. A subclass can add new public or private methods. Add an accessor method named getRacesWon . . Add a mutator method named winRace 3. A subclass can override (redefine) inherited methods. .Override the toString method 4. A subclass must define its own constructors Add a default constructor Add a second constructor which includes 4 parameters to initialize the instanoe variables owner, age, value, and numRacesWon . 5. A subclass cannot access the private members of its superclass. wner John Wayne alue S250000.0 Races won- 2 wner Jimmy Stewart ge4 alue $325000.0 aces won 8

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!