Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(JAVA) Using the provided code, write a program that finds and prints the average of values that is above the average of values. For instance,

(JAVA)

Using the provided code, write a program that finds and prints the average of values that is above the average of values. For instance, the average of the values {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0} is 5.0. The values above that average are {6.0, 7.0, 8.0, 9.0}, and so its average would be 7.5. You may assume that all values are non-zero and non-negative. The program should use the array provided in the code (its identifier called array), and you may assume that it has already been populated with values. The results should be printed out to the console in the following format:

Average Above Average is: <>

Values denoted in << >> represent variable values, and strings in quotations denote literal values (make sure to follow spelling, capitalization, punctuation, and spacing exactly). Also, if there are no values above the average then print out 0.0.

PLEASE ALSO INCLUDE SUMMARY/DESCRIPTION OF HOW YOU GOT PROGRAM TO WORK (METHODS USED, ETC)

PROVIDED CODE:

//Do not alter----------------------------------------------------------------------- import java.util.Scanner; public class Question04 {

public static double[] array;//The array to be used in the problem public static void main(String[] args) { if(args == null || args.length == 0) { //----------------------------------------------------------------------------------- double[] tempArray = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0};//You may change these values to test your solution //double[] tempArray = {92.0, 69.0, 35.0, 27.0, 9.0, 83.0, 89.0};//You may change these values to test your solution //double[] tempArray = {1.0, 1.0, 1.0, 1.0, 1.0};//You may change these values to test your solution //Do not alter----------------------------------------------------------------------- array = tempArray; } //----------------------------------------------------------------------------------- //Write your solution here

}//Do not alter this //Space for other methods if necessary----------------------------------------------- //Write those here if necessary //----------------------------------------------------------------------------------- }//Do not alter this

Solution Tests:

  • If the array has the values {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0} does the program print out:

Average Above Average is: 7.5

  • If the array has the values {92.0, 69.0, 35.0, 27.0, 9.0, 83.0, 89.0} does the program print out:

Average Above Average is: 83.25

  • If the array has the values {1.0, 1.0, 1.0, 1.0, 1.0} does the program print out:

Average Above Average is: 0.0

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

What are the major social responsibilities of business managers ?

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago

Question

=+3 In what ways can an MNE improve or change its approach to IHRM?

Answered: 1 week ago