Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a program that looks for the tallest basketball player whose age is less than or equal to the average of all the . There

Develop a program that looks for the tallest basketball player whose age is less than or equal to the average of all the . There must be three classes within the program. The first class (Height) should contain two iinteger instance to represent the feet and inches. The class should be immutable; so it should have no setter methods At a minimum it should contain the following methods:
A constructor that accepts feet and inches constructs a Height object
A method toInches that returns the height in total inches
A method tostring that returns the string representation of the height with a single quote following the feet and a double quote following the inches
No matter what the value for inches was supplied to, the constructor the toString method should display the height normalized so the inches are less than 12.
The second class (Player) should contain three instance variables that include the player's name, the player's height, which should be stored as the type Height, and the player's age. The class should be immutable, so it should have no setter methods It should contain the following methods:
A constructor that accepts a player's name, height and age constructs a Player object
Getter methods for each of the instance variables
A method toString that returns the string representation of a player with each field appropriately labeled
The tostring method of the Player class should call the tostring method of the Height class.
The third class Project1 should continuosly prompt the user for the information for each of the players. It should then create a player object for each player and add the player to an ArrayList. As the players are read in, the total age of all players should be computed to enable the average to be calculate once all have been input. Once all player information has been input, the average age of all players should be output. Then the list of players should be traversed to find the tallest player whose age is less than or equal to the average age of all players.

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

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions

Question

305 mg of C6H12O6 in 55.2 mL of solution whats the molarity

Answered: 1 week ago

Question

What are some of the possible scenes from our future?

Answered: 1 week ago