Week03_IT218 - int numOfAbove = 0 int numOfBelow = 0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 /** Trinity Martin */ (lab 3.2) import javax.swing.JOptionPane public class Exercise6_4 { // Main method public static void main(String[] args) { double[] scores = new double[100] double sum = 0 int count = 0 do { String scoreString = JOptionPane.showInputDialog(null, "Enter a new score") scores[count] = Double.parseDouble(scoreString) sum += scores[count] } while (scores[count++] >= 0) double average = (sum - scores[count]) / (count - 1)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int numOfAbove = 0 int numOfBelow = 0 for (int i = 0 i < count - 1 i++) if (scores[i] >= average) numOfAbove++ else numOfBelow++ System.out.println("Average is " + average) System.out.println("Number of scores above or equal to the average " + numOfAbove) System.out.println("Number of scores below the average " + numOfBelow) System.exit(0) } } (lab 3.3)...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online