CS0004: Programming Project 3

Assigned:March 14, 2007
Final Project Due:
 March 26, 2007
Solution:solution

Overview

In this assignment, you will be reading a series of numbers from files then caculating various statistics using these numbers. In this project you should learn how to read data from a file, create arrays, use arrays, and search arrays.

The following functions _must_ be created.

  • readData - takes a filename as a paramater and returns an array of doubles read from the file.
  • calcSum - takes an array of doubles and returns the sum
  • calcCount - takes an array of doubles and returns the count
  • calcAverage - takes an array of doubles and returns the average
  • calcMin - takes an array of doubles and returns the minumum value
  • calcMax - takes an array of doubles and returns the maximum value

The second part of the assignment is search the file for a particular value. The search function should search the array created using the readData function. For the assignment you must create a function that takes two parameters, an array of doubles and a search query. The function should return an array index where the search value can be found or -1 if the value does not exist in the array.

Example Files

The file that must be read by your program is assumed to have a single number on each line. You can create your own files but I will provide you with several example files that will allow you to test your program.

numbers_1 can be downloaded and used a test file. It should produce the following stats:

Count:12
Sum:335
Average:27.9166...
Max:55
Min:-32

numbers_2 can be downloaded and used a test file. It should produce the following stats:

Count:25
Sum:17474.414
Average:698.97656
Max:9302.23
Min:-32

The Interface

images/interface_pa3.jpg

The interface should allow the user to provide the program with a file path and then have the program load that file using the "Load" button. Once the file is loaded the user should see the file stats and be able to search the file for a given value. The search button should be disabled prior to hitting the load button.

Grading

The grading sheet for this assignment is posted. The entire project is worth 100 points. Various items will be graded including functionality, design, proper use of form elements, code style, documentation, etc. Please note that documentation is graded, you must document your code!

Submission

Again, there are two parts to turn in for the final project. First, you need to bring a printout of the code window to class on March 26. Second, create a zipped folder containing the entire project. Name this file Lastname_Firstname_Assignmentnumber.zip. Example: Mills_Bryan_3.zip

Don't use spaces in your filename thats just bad, not cool, and always wrong.

You then need to upload this zip file to the following location, http://www.cs.pitt.edu/~bmills/upload/ . This web page will allow you to upload your zip file only once. If you need to upload your file again add a revision number to the end of the file (ie Mills_Bryan_3_2.zip, Mills_Bryan_3_3.zip). I will grade the file with highest revision number.

Let me know if you have any problems uploading files by emailing me. I will not accept submissions turned in late some don't even try it, I have millions of little monkeys in the computer watching for late submissions.

Extra Credit

I will offer a 10 point extra credit opportunity. If you have an idea for extra credit, email me or stop by during office hours and we can discuss it. Extra credit is added based upon the level and scope of the extra credit attempted. NO EXTRA CREDIT WILL BE AWARDED FOR ADDITIONS NOT DISCUSSED AND APPROVED!