Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

Students also viewed these Databases questions