Question: Create a class definition that describes a basketball player with appropriate instance variables and get and set methods so that users can access the class
Create a class definition that describes a basketball player with appropriate instance variables and get and set methods so that users can access the class later to create objects. Name this class Basketball.java.
Your program will require the user to enter 5 players with these fields: First Name, Last Name, Points Scored, Rebounds, and Fouls.
Create a second class named BasketballStatistics.java. It will contain these features:
This is assumed to be a secure data entry system, so you must require correct entry of a system username and password before data can be entered. The username MUST be admin, although the interface must allow for any case combination. The password MUST be 9999. If there are a total of 3 incorrect login attempts, the user will be presented with a message that he/she has reached the maximum number of incorrect logins, and the program must terminate. Write your own custom method(s) to accomplish this. Hint: think loops!
Once the user is authenticated, you will need to present the user with a series of questions that prompt the user to enter First Name, Last Name, Points Scored, Rebounds, and Fouls for exactly 5 players, utilizing the class definition that we created earlier). Each player must be considered to be an object. Also, the input data must be of the correct format as specified below:
Text entries must be modified to this convention: All uppercase letters (example: User enters jerEmY but we store it as JEREMY in the object field).
There must be some sort of validation so that integer fields are realistic. For example, in basketball, points and rebounds are never a negative number, and are highly unlikely to be more than 99. Also, in college basketball, it is impossible to accumulate a negative number, or more than 5 fouls.
NOTE: You do not have to validate for empty strings or data type entry errors (such as entering strings for integer fields). We will cover this in the second half of the course.
Once all 5 players are initialized, print out a nice columnar output of each player, preceded by a header row that defines the data. Note below that first and last name fields have been concatenated, and that first name is modified so that the first initial, a period, and a max of 8 letters of the last name are shown! For example, if one players name is Billy Swarovsky, it would be displayed like this:

Hint: Because the Last Name field must print out as exactly 8 characters, I would recommend that you handle padding this field to exactly 8 (if the name is less than 8 characters) when you store the value in the object field, and truncating the field to exactly 8 when you print the report, if it is more than 8 characters.
At the bottom of the report, there should be team totals that add the fields for the team. Points will be deducted if columns do not line up.
Sample output could look like this:
Player Name Pts Rbs Fouls
N. JONES 15 9 3
S. AUSTIN 9 4 2
A. MAZZONE 12 0 1
M. KING 4 1 5
A. JOHNSTON 0 4 2
TEAM TOTALS 40 18 13
layer Name Pts Rbs Fouls SWAROUSK
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
