Question: Polymor. Code (Java) Program Specifications: You are to design the following project: A person has a name, and age. An athlete is a person. An

Polymor. Code (Java)

Program Specifications:

You are to design the following project:

A person has a name, and age.

An athlete is a person. An athlete has a team and position.

A baseball player is an athlete and a person.

A baseball player has a battingPosition.

Baseball players either bat lefthanded, righthanded or both.

A football player is an athlete and a person.

A football player has a specialty.

A football player's speciality is either Offense, Defense, or Special Teams.

A hockey player is an athlete and a person.

A hockey player has a stickBrand.

A golfer is an athlete and a person.

A golfer has a mainSponser.

A soccer player is not an athlete or a person...therefore

soccer does not exist.

All sport type objects have a method named doThis();

Baseball -> doThis() displays I hit something.

Football -> doThis() displays I tackle something.

Hockey -> doThis() displays I sit in a penalty box.

Golfer -> doThis() displays I putt it in the hole.

...all sports have a doThis() method that displays something.

Main()

create the class Person, Athlete, Baseball

create the class Football, Hockey, Golfer

Create the doThis() method in each class

In main create the follow reference variables

Baseball Hank (create this reference variable)

Football Terry (create this reference variable)

Hockey Mario (create this reference variable)

Golfer Tiger (create this reference variable)

Baseball Barry (create this reference variable)

Football Payton (create this reference variable)

Hockey Wayne (create this reference variable)

Golfer Phil (create this reference variable)

Call each sports doThis method (one at a time) passing each player.

call the toString methods for each player object.

YOU CANNOT:

Use global variables, the word goto, the break command outside a case statement

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!