Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PLEASE 13.15 Lab: Simple Arrays Analyzing People's Weights Start with the provided template code. Test 1: Using a loop, prompt the user to enter

JAVA PLEASE

13.15 Lab: Simple Arrays

Analyzing People's Weights

Start with the provided template code.

Test 1: Using a loop, prompt the user to enter five numbers, that are five people's weights. Store the numbers in an array of doubles. Then use another loop to output the array's numbers on one line, with each number followed by one space. Example:

Enter weight 1: 96.6 Enter weight 2: 212.2 Enter weight 3: 150.5 Enter weight 4: 120.1 Enter weight 5: 175 You entered weights: 96.6 212.2 150.5 120.1 175.0 

Test 2: Add code to loop and summing the array's elements to compute the total weight. Output the result rounded to 2 decimal places with the last digit in column 24.

Test 3: Add code to compute and output the average of the array's elements, rounded to 2 decimal places, lined up on the decimal with the total.

Tests 4 - 6: Add a method definition for a method to find and return the smallest weight in the array. The 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 and average.

Example:

Enter weight 1: 96.6 Enter weight 2: 212.2 Enter weight 3: 150.5 Enter weight 4: 120.1 Enter weight 5: 175 You entered weights: 96.6 212.2 150.5 120.1 175.0 Total weight: 754.40 Average weight: 150.88 Min weight: 96.60

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 method definition here */ }

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions