Create using NetBeans a complete Java program called Weighte

Create, using NetBeans, a complete Java program called WeightedAvgDropSmallest according to the following guidelines.

The program prompts the user for five to ten numbers all on one line, separated by spaces, calculates the weighted average of all those numbers except the lowest n numbers, where n and the weight are also given by the user, and displays all the numbers, the weight, the number of lowest numbers dropped, and the calculated average to the user.

The program uses methods to:

get the numbers whose average is to be calculated

get the number of numbers to drop before calculating the average

get the weight – a double from 0.0 to 1.0 – to use to calculate the weighted average

calculate the weighted average of the numbers (except the lowest n numbers) entered by the user; and

print the results.

The first method should take no arguments and return an array list of numbers (doubles) that the user entered.

The second method should take no arguments and return an integer (the number of the lowest numbers to be dropped before calculating the average).

The third method should take no arguments and return a double (the weight)

The fourth method should take three arguments: an array list of numbers (the return value of the first method above); an integer (number of smallest items to drop before calculating the average); and a double (a weight between 0.0 and 1.0 inclusive). This method should return a double (the weighted average of all the numbers except the lowest n values).

The fifth method should take four arguments: an array list of numbers (the return value of the first method above); an integer (number of smallest items to drop before calculating the average); a double (a weight between 0.0 and 1.0 inclusive); and a double (the weighted average returned from the fourth method above). This method should have no return value.

For example:

If the user input is:

40 60 80 100 20

and the user gives the number 2 to indicate how many of the lowest values should be dropped before calculating the average, and gives a weight of 0.5 to be used in calculated the weighted average, then

the program should give as output:

Given the numbers 40.00, 60.00, 80.00, 100.00, and 20.00, and using a weight of 0.5, the weighted average of all the numbers except the lowest 2 numbers is 40.00.

Solution

OUTPUT

Enter the numbers whose weight is to calculated
20 40 60 80 100
Enter count of numbers to be dropped
2
Enter the weight
0.5
The list of numbers: [20.0, 40.0, 60.0, 80.0, 100.0]
Count of numbers to be dropped: 2
Weight: 0.5
Weighted average: 40.0

Create, using NetBeans, a complete Java program called WeightedAvgDropSmallest according to the following guidelines. The program prompts the user for five to t
Create, using NetBeans, a complete Java program called WeightedAvgDropSmallest according to the following guidelines. The program prompts the user for five to t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site