Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete Java program called WeightedAvgDropLowest according to the following guidelines: 1 The program prompts the user for five to ten numbers all on

Write a complete Java program called WeightedAvgDropLowest according to the following guidelines:

1 The program prompts the user for five to ten numbers all on one line, separated by spaces

2 calculates the weighted average of all those numbers except the lowest number and then displays all the numbers in the order that the user gave them, the weight, and the weighted average to the user.

3 The program uses methods to: Prompt the user for five to ten numbers - all on one line with each number except the last followed by a space - and store these numbers in an ArrayList of Double values Prompt the user for the weight, a double value greater than 0 and less than or equal to 1,

4 Calculate the smallest number in the ArrayList of numbers Calculate the weighted average of the numbers (except the lowest number) entered by the user, and Print the results. 5 The method for getting the numbers from the user should take no arguments and return an array list of doubles.

6 The method for getting the weight should take no arguments and return a double value

7 The method for calculating the lowest value of the numbers the user entered should take an array list as its only argument and return a double. This method may not use any sort routine from any Java class library

8 The method for calculating the weighted average should should take two arguments: an ArrayList of Double values and a single double value, and it should return a single double value

9 The method for printing information to the user should take two arguments: an ArrayList of double values and a single double value, and it should print all the numbers in the order the user entered them, along with the weight and the weighted average.

10 All double values should be printed to two decimal places.

EXAMPLE: If the user gives these numbers for calculating the average: 40 60 80 100 20 and gives 0.5 as the weight to be used, then the program should print: "Given the numbers 40.00, 60.00, 80.00, 100.00, and 20.00, and a weight of 0.50, the weighted average of all the numbers except the smallest number is 35.00."

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 Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions