Java Program

  

Write a program, in a file called MeanNumbers.java, that collect integer variables from the user until the user enters a non-positive value. It the user has enter less than two values, display a message “Insufficient data.” and stop. If the user enters more than 10 values, display “Too many values” and stop. Otherwise, call the following methods and display the results: double arithmeticMean(int [] d), double harmonicMean(int [] d), and double harmonicMean(it [] d). arithmeticMean should calculate the arithmetic mean: am= ∑i=0 N d [i] N , harmonicMean should calculate the harmonic mean: am= ∑i=0 N 1 d [i] N , and geometricMean should calculate the geometric mean: am= N √∏i=0 N d[i] .

Tags: No tags