Write a program that contains a method avgWithoutSmallest. The method should compute the average of an array of values,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Write a program that contains a method avgWithoutSmallest. The method should compute the average of an array of values,

Post by answerhappygod »

Write A Program That Contains A Method Avgwithoutsmallest The Method Should Compute The Average Of An Array Of Values 1
Write A Program That Contains A Method Avgwithoutsmallest The Method Should Compute The Average Of An Array Of Values 1 (38.01 KiB) Viewed 42 times
Write A Program That Contains A Method Avgwithoutsmallest The Method Should Compute The Average Of An Array Of Values 2
Write A Program That Contains A Method Avgwithoutsmallest The Method Should Compute The Average Of An Array Of Values 2 (55.51 KiB) Viewed 42 times
Write a program that contains a method avgWithoutSmallest. The method should compute the average of an array of values, except for the smallest one, in a single loop. In the loop, update the sum and the smallest value. After the loop, return the average of all numbers except the smallest one. The main program should then display the returned value. Hints: The main program should declare and populate the array. Then it should call the method, and display the value returned from the method. The method should have ONE loop that: • Calculates the running total o See "Sum and Average" under Common Algorithms section 6.3 • Tracks the value of the smallest number o See "Maximum and Minimum" under Common Algorithms section 6.3 After the loop, calculate the average of all numbers EXCEPT the smallest The total will be (sum - smallest) • You will divide by (array length - 1)
The method should have ONE loop that: • Calculates the running total o See "Sum and Average" under Common Algorithms section 6.3 • Tracks the value of the smallest number o See "Maximum and Minimum" under Common Algorithms section 6.3 After the loop, calculate the average of all numbers EXCEPT the smallest • The total will be (sum - smallest) • You will divide by (array.length - 1) • Remember to typecast this as a double Create a small array (3 or 4 numbers) at first and check your program's results with a calculator.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply