P6: Fun with Arrays

COMP 14-091 Summer Session I 2000


Assigned: Friday, June 16

Due: Friday, June 23, at the beginning of class!
 

Description

This assignment gives you a chance to work with arrays and hopefully to see how useful they are. You should write a program that creates an array of 10 doubles (floating point numbers) and then asks the user to enter the 10 doubles (if you can't figure out how to make doubles work, then you can use int instead, but you will lose points for this). After reading the 10 values in from the user, you need to print out the contents of the array and then calculate the following things:
  1. the minimum value in the array
  2. the maximum value in the array
  3. the sum of the elements of the array
  4. the average of the elements of the array
  5. the average of the squares of the elements of the array (square each element in the array and then average these squared values)
  6. the variance of the array = average of the squares minus the square of the average (so #5 - the square of #4)
  7. the standard deviation = the square root of the variance (so the square root of #6)
Each of these calculations should be in a separate method! To get you started, I have written the method that calculates the minimum value of the array. If you can't get the extra methods to work, then you can do all the calculations in main, but you will lose points for doing that!

Hints

Don't forget to check the program grading criteria to see all the normal stuff your program should do.

Extra Credit

For this assignment you can do the following to get extra credit. However, you can only receive a maximum of 100 points for this assignment. These are also all or nothing - no partial extra credit.

Steps to Follow

This time you will only have one class in your project. It should be a ClassMain class when you create it. You should call it ArrayComputation.java. Click on this link to get my framework version of it that has the first method written for you already.

Don't forget all the comments and the honor code pledge that should go at the top of each class in your program!

What to turn in

(don't forget to keep a copy for yourself!):

Notes

Note: this is only an example. Your work does not need to match the example word for word.

Here is an example run with the extra credit working: