[Solved] CalcAvgDropLowest , MinMax , Scorer

25 $

File Name: CalcAvgDropLowest_,_MinMax_,_Scorer.zip
File Size: 329.7 KB

SKU: [Solved] CalcAvgDropLowest , MinMax , Scorer Category: Tag:
5/5 - (1 vote)
  1. Write a complete Java program called CalcAvgDropLowest according to the following guidelines.

The program prompts the user for five to ten numbers, all on one line, and separated by spaces. It then calculates the average of all those numbers except the lowest n number(s), where n is given by the user, and displays all the numbers and the calculated average to the user.

The program uses methods to:

  1. get the numbers used to calculate the average,
  2. get the number of lowest numbers to drop before calculating the average,
  3. calculate the average of the numbers (except the lowest n number(s)) entered by the user, and
  4. print the results.

The first method should take no arguments and return an array of doubles.

The second method should take no arguments and return a single integer, the number of the lowest numbers to drop before calculating the average.

The third method should take an array of doubles (the return value of the first method above) and a single integer value (the number of lowest items to drop before calculating the average) and return a double (the average of all the numbers except the lowest n values).

The fourth method should take an array of doubles, an integer, and a double as arguments but have no return value.

For example:

If the user gives these numbers for calculating the average:

40.00 60.00 80.00 100.00 20.00

and the user gives the number 2 to indicate how many of the lowest values should be dropped before calculating the average, then

the program should give as output:

Given the numbers 40.00, 60.00, 80.00, 100.00, and 20.00, the average of all the numbers except the lowest 2 numbers is 80.00.

  1. Write a complete Java program called MinMax that declares an array of doubles of length 5, and uses methods to populate the array with user input from the command line and to print out the max (highest) and min (lowest) values in the array.

3, Write a complete Java program called Scorer that declares a two-dimensional array of doubles (call it scores) with three rows and three columns and that uses methods and loops as follows:

Use a method containing a nested while loop to get the nine (3 x 3) doubles from the user at the command line.

Use a method containing a nested for loop to compute the average of the doubles in each row.

Use a method to output these three row averages to the command line.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CalcAvgDropLowest , MinMax , Scorer
25 $