Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make a list of numbers to calculate the arithmetic mean of the remainder?
    text
    copied!<p>I have a project about java which wants me from to writing a console program that reads in a list of number scores on one line, separated by spaces, discards the highest and lowest numbers, then calculates the arithmetic mean of the remainder.</p> <p>I have problems about how to make a array-list of number to calculate he arithmetic mean.</p> <p>These are the codes : </p> <p>Actually these codes are working in Java Applet and Java Application but I can take the numbers with scanner method but I couldn't find a solving way to make a list for the numbers.</p> <pre><code>public static void main(String[] args) { /* * For data input. */ Scanner kb = new Scanner(System.in); /* * Declare an array to store the judge's scores. */ double[] scores = new double[8]; /* * Declare variables for lowest and highest scores. */ double lowestScore = Integer.MAX_VALUE; double highestScore = Integer.MIN_VALUE; /* * Read 7 judge's scores. */ for (int i = 0; i &lt; 7; i++) { System.out.println(String.format("Judge Score #%d: ", i + 1)); scores[i] = kb.nextDouble(); /* * Compare the current score with the lowest and the highest scores. */ if (scores[i] &lt; lowestScore) { lowestScore = scores[i]; } if (scores[i] &gt; highestScore) { highestScore = scores[i]; } } /* * Sum the scores, except the lowest and the highest scores. */ double total = 0.00; for (int i = 0; i &lt; 7; i++) { if (scores[i] != lowestScore &amp;&amp; scores[i] != highestScore) { total = total + scores[i]; } } /* * Display the output. */ DecimalFormat df = new DecimalFormat("0.00"); System.out.println("Total points received: " + df.format(total)); System.out.println("Arithmetic Mean : " + df.format(total / 7)); } </code></pre> <p>Does anyone has another ideas about my question ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload