# Create, using NetBeans, a complete Java program called -- ( CalcWeightedAvg ) solved

Create, using NetBeans, a complete Java program called -- ( CalcWeightedAvg ) according to the

following guidelines.

The program should use methods to carry out all computations.

The method

readIntValues

should take no arguments, prompt the user to enter one line of

between 5

and 10

space-separated integers with values between 0 and 100 (inclusive) and

return an array list

of

these integers.

The method

getWeight

should take no arguments, and it should prompt the user for a double with

value greater than 0.0 but less than or equal to 1.0, and return as a double the value the user entered.

The method

calcWeightedAvg

should return a double and take two parameters:

an array list of

integers

and a double called weight (with values greater than 0.0 but less than or equal to 1.0). It

should

calculate the average of the values in the integer array by

removing the lowest value from

consideration and calculating the average of the other value

s

, and then multiply that average by the

weight, and return the result.

Note: If there are several “lowest” values, remove only one of them.

For example, if calcWeightedAvg is invoked as calcWeightedAvg(intArrayList, weight) (with weight =

0.50) then it should calculate the average of all values but the lowest value in intArray, multiply that

average by 0.50 and return the result to the main method, which will then display that value to the

user.

Example:

integer input: 20 20 40 60 80 100

weight input: 0.50

calcWeightedAvg invoked as calcWeightedAvg(intArrayList, weight) returns 30.0, because one of the

“20” values is dropped from consideration when calculating the average.

Your output should be something like this: “With input values 20 20 40 60 80 100 and with a weight

of 0.50, when dropping the lowest value, the weighted average of the remaining values is 30.0.”

2. Export your project from NetBeans as a zip file (File → Export Project → To ZIP)

following guidelines.

The program should use methods to carry out all computations.

The method

readIntValues

should take no arguments, prompt the user to enter one line of

between 5

and 10

space-separated integers with values between 0 and 100 (inclusive) and

return an array list

of

these integers.

The method

getWeight

should take no arguments, and it should prompt the user for a double with

value greater than 0.0 but less than or equal to 1.0, and return as a double the value the user entered.

The method

calcWeightedAvg

should return a double and take two parameters:

an array list of

integers

and a double called weight (with values greater than 0.0 but less than or equal to 1.0). It

should

calculate the average of the values in the integer array by

removing the lowest value from

consideration and calculating the average of the other value

s

, and then multiply that average by the

weight, and return the result.

Note: If there are several “lowest” values, remove only one of them.

For example, if calcWeightedAvg is invoked as calcWeightedAvg(intArrayList, weight) (with weight =

0.50) then it should calculate the average of all values but the lowest value in intArray, multiply that

average by 0.50 and return the result to the main method, which will then display that value to the

user.

Example:

integer input: 20 20 40 60 80 100

weight input: 0.50

calcWeightedAvg invoked as calcWeightedAvg(intArrayList, weight) returns 30.0, because one of the

“20” values is dropped from consideration when calculating the average.

Your output should be something like this: “With input values 20 20 40 60 80 100 and with a weight

of 0.50, when dropping the lowest value, the weighted average of the remaining values is 30.0.”

2. Export your project from NetBeans as a zip file (File → Export Project → To ZIP)

You'll get a 13.5KB .ZIP file.