CISC 105 Fall 2006 Project 2
CISC 105 Fall 2006 Project 2
Due Sunday November 12 at midnight
(12:00 a.m. Monday)
This project is about reading data from a file and using
arrays. Arrays allow us to store large amounts of data and access it
very quickly.
A somewhat modified file of weather data from the Delaware State
Climatologist's office is on the class website. It has temperature
data from 2001 and 2002. The climatologist's website is at
http://www.udel.edu/leathers
General Idea
Store the data in three 2-d arrays: a 2-d array of integers for the dates, and
a two-dimensional array of doubles for the temperatures, and a 2-d
array of char for the location names. Do not create other arrays for
holding all the data in
this project. You may need a small array or two, for example to
temporarily hold a
single line of data that you read from a file.
Read the data file only once and fill the arrays. Write separate functions that:
- Print highest temp in all data
- Print lowest temp in all data
- Print data for one month with nice headers and formatting.
- Print highest temp in < month > , < year >
- Print lowest temp in < month > , < year >
- Print average high temp in < month > , < year >
- Print average low temp in < month > , < year >
- Print highest temp for < location > in < month > , < year >
- Print which location had the highest temp in < month > , < year >
- Allow the user to replace existing data in the temperature array for a given
day, month and year.
These functions should be available to the user from a menu of
choices. If a temperature in the dates considered has an error, then
your message should include something like "Data for this query was
not complete."
For an A grade
A perfect implementation of the program described above will receive a
score of 90. To be eligible for all 100 points, also do the following:
Suggestions
- Read the project FAQ. As students ask questions, I will put some
of the common ones there with answers.
- Start every programming session by saving a numbered copy of
your previous work. Always keep the previous versions, in case you need
to backtrack.
- Start small. Think about how you can break the program into
pieces, and code each piece before you try putting the
parts together. A possible approach:
- Write a program that reads a single number from a file and
prints it out.
- Copy, and modify so that it reads and prints one date.
- Copy, and modify so that it reads one date into the date array.
- Copy, and modify so that it reads one date and one high temperature.
- Etc. Use your own ideas and come up with other ways to break it
down into small pieces. Ideally, the pieces will become functions!
Getting Started
Use constants to make your 2-d arrays easy to manage. For example:
#define SIZE 638
#define MONTH 0
#define DAY 1
#define YEAR 2
... more stuff here
int dates[SIZE][3];
... more stuff here
if (dates[i][MONTH]= currMonth &&
dates[i][DAY] = currDay &&
dates[i][YEAR] = currYear) ...
See the FAQ in this directory. As general questions come in, I'll put
the answers there.
Submission
Design and test your program carefully! Check the calculations!
Shortly before the project is due you will be given test data and a
project submission sheet. You must show that your program performs
correctly for all test data, and you must complete the
submission sheet and turn it in with your project's
paper copy. Of course, all code must be submitted to
MyCourses along with your script file. Paper copy is due the
following class (Friday).
File translated from
TEX
by
TTH,
version 3.38.
On 6 Nov 2006, 19:30.