Complete the following tasks: a. Design a class named Player that holds a player number and name

Question:

Complete the following tasks:

a. Design a class named Player that holds a player number and name for a sports team participant. Include methods to set the values for each data field and output the values for each data field.

b. Design two classes named BaseballPlayer and BasketballPlayer that are child classes of Player. Include a new data field in each class for the player’s position. Include an additional field in the BaseballPlayer class for batting average. Include a new field in the BasketballPlayer class for free-throw percentage. Override the Player class methods that set and output the data so that you accommodate the new fields.

c. Design an application that instantiates an object of each type and demonstrates all the methods.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: