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

  • Stop wasting time looking for files and revisions! Dokkio, a new product from the PBworks team, integrates and organizes your Drive, Dropbox, Box, Slack and Gmail files. Sign up for free.

View
 

Java Assignment  - Arrays 1

Page history last edited by Steve Sweeney 9 years, 11 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)

Comments (0)

You don't have permission to comment on this page.