Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Analyzing Football Players' Weights Do not hardcode the number 5 in your code. Use the provided constant instead. NOTE: JavaDoc style documentation is required for

Analyzing Football Players' Weights

Do not hardcode the number 5 in your code. Use the provided constant instead.

NOTE: JavaDoc style documentation is required for this program.

Test 1: Using loops: - Prompt the user to enter 5 pairs of numbers, that are 5 player's jersey numbers and weights. Store the jersey numbers in an array of integers. Store the weights in an array of doubles. - Output the values entered, one player per line, with one space between the jersey number and weight. Example:

Enter jersey number for player 1: 34 Enter weight for player 1: 96.6 Enter jersey number for player 2: 87 Enter weight for player 2: 212.2 Enter jersey number for player 3: 49 Enter weight for player 3: 150.5 Enter jersey number for player 4: 26 Enter weight for player 4: 120.1 Enter jersey number for player 5: 77 Enter weight for player 5: 175 You entered jersey numbers and weights: 34 96.6 87 212.2 49 150.5 26 120.1 77 175.0 

Test 2: Add code to:

  • Display a blank line
  • Compute and output the total weight, after summing the weight array's elements, rounded to 2 decimal places with the last digit in column 24.

Test 3: Add code to compute and output the average weight stored in the weight array, rounded to 2 decimal places, lined up on the decimal with the total weight.

Tests 4 - 6: Add a method definition for a method to find and return the lowest weight in the weight array. The weight array will be passed into the method as a parameter.

Call the method and then display the returned value, rounded to 2 decimal places, lined up on the decimal with the total weight and the average weight.

Example:

Total weight: 754.40 Average weight: 150.88 Min weight: 96.60 

Tests 7 - 11: Add a method definition for a method to find and display the weight of a specific player, given their jersey number.

  • The jersey number to find, and the both arrays, will be passed into the method as parameters.
  • The method will find and display that player's weight (or display "No player with jersey number XX" if the jersey number is not found).

At the end of the main method,

  • Display a blank line
  • Prompt the user for a jersey number. After reading the jersey number from the user, call the method to find and display that player's weight.

Example 1:

Enter jersey number of player to find: 49 Player with jersey number 49 weighs 150.5 

Example 2:

Enter jersey number of player to find: 100 No player with jersey number 100

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

import java.util.Scanner;

public class WeightAnalysis { final static int NUM_WEIGHTS = 5;

public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); /* Add main method code here. */ return; } /* Add additional method definitions here -- include JavaDoc style documentation*/ }

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 Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago