CS 1301 Program 4 Fall 2014


Design, Test Cases, Source Code due: Friday, November 14th by 11:59PM

Grading Criteria for Program 4 CS 1301 Fall 2014

Syntax checking- if it does not run without errors or warnings, it will not be graded
Program
Correctness
60

Gets data from user

Functions are defined properly and of the correct type

average function correct

median function correct

stdev function correct

Loops used correctly

Displays results correctly, both values, text and formatting (line breaks, etc.)
Testing 15

Test cases /15
Program Design 15

Individual design /15

Design and source code are NOT the same thing (10 point penalty!)
Style and
documentation
10

Prolog Comment with Name, Section, Email, Date, Purpose

Meaningful Variable Names

Documentation of Code

Source code Indentation/
   formatting/ whitespace
Total 100
Late Penalty

I have the authority to deduct points for other items which do not follow the program specifications, as given in the assignment page, or the documentation or other standards stated on the class web page.

Educational Goals: The educational goals of this program are that the student should use the concepts of

Problem Description:

Descriptive statistics help researchers summarize a dataset. For this assignment, you will write a program that prompts the user for 11 grades (integer values, ranging from 0 to 100) and compute the following statistics:

Each statistic will be computed by a function. You will have three functions:

Average or mean
The mean of a set of numbers is computed as follows:


where xi is the ith element of the array and N is the total number of elements.

Median
The median of a set is the number that separates the bottom half of numbers from the top half. You will need to sort the array of grades, then the median will be the element in the middle. Since there are only 11 grades, the median will be the 6th element in the sorted array.

Standard deviation
The standard deviation is computed as follows:


where xi is the ith element of the array and N is the total number of elements.

Sample interaction with the program:

Example run 1:
Please enter 10 grades (between 0 and 100): 10 20 30 40 50 60 70 80 90 100 90
The average grade is: 58.18181818181818
The median grade is: 60
The standard deviation is: 29.176011883420387


Example run 2:
Please enter 10 grades (between 0 and 100): 60 70 90 67 95 45 90 100 80 100 56
The average grade is: 77.54545454545455
The median grade is: 80
The standard deviation is: 18.162717239462303


Notes:

Test Cases

First, read the assignment carefully. Look for how the program is supposed to behave. You do not know what the code looks like - that is fine. The assignment gives some examples of normal runs. There are other test cases needed. Create a test case table similar to that of previous programs. The test cases are due at the same time your design and code are due.

Design


Decide on what steps you will need to perform to solve this problem. Make a numbered list and put it in Java form. Save this Java file as "design3.java". Each function should have steps numbered from 1
// main function
// step 1: prompt for grade
// ... enter your steps here
// compute things
// output things


// average function
// fill in the rest of the design

//  design the other functions
...

and individually fill in the missing steps in the design. This is due by Friday, November 14th, 11:59PM same time the code and test cases.

Implement the design

Write a Java program to implement your design. Make a copy of the Java file you have that has the design in it and write your Java code between the commented lines of the design. Make sure you eliminate any syntax and semantics errors. Here is where test cases come in handy! Submit your individual source code with the link here. Choose the menu choices of "Code" and "Program 4". This is due by Friday, November 14th, 11:59PM.

There are several specifications about how your program should be written.

Please read the documentation standard on the class web page. As you can see from looking at the grading criteria, we will be looking to see how you meet these standards. Note particularly that we require a prolog!

Remember that the program must run with NO errors or warnings. If it does not, it will not be graded!