• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

• Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.

View

# Java Assignment  - Arrays 1

last edited by 10 years, 9 months ago

Write a program that will read an unknown number of marks (out of 100), quitting when reading a sentinel of -1 is read.  Assume the marks are whole numbers.  Output an error message for marks above 100.

(a) Calculate and display the arithmetic mean of the marks.  The mean is the sum of all marks divided by the number of marks.  Round your result to one decimal place.

(b) Determine the mode of the marks.  The mode of a group of values is the value that occurs most often in the group.  A group may have more than one mode if more than one value occurs with the maximum frequency.

(c) Determine the median of the marks.  If there is an odd number of marks, the median is the middle one.  If there is an even number of values, the meadian is the mean of the two scores on either side of the middle.

10 20 30 has a median of 20

10 20 30 40 has a median of 25 (the mean of 20 and 30)