CISC 105 Fall 2006 Project 3
CISC 105 Fall 2006 Project 3
Due Sunday December 3 at midnight (12:00 a.m. Monday)
This project is a re-write of project 2. Most programming time is
spent modifying existing code, so this is good practice. As you change
your project, think (constructively!) of how you might make it easier
on yourself next time: Do functions represent single ideas that are
easy to change without changing lots of other functions? Do the names
you wrote before still make sense?
As before, read the weather file. However, this time you will read it
into an array of structs. Your program will have all the functionality
it had before, and more!
Use the strtok function to parse each line of data. This is required.
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
Code all features to here for a maximum grade of 60.
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 >
Allow the user to read in a new data file while the program is
running, so that you can read multiple files in a single run. Any
new file data should completely replace old data in your
array. Prompt the user for a filename.
Read new data to the end of the file, not a fixed number of
lines. The number of lines will not exceed 700.
Code all features to here for a maximum grade of 70.
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.
Make a bar chart (horizontal) plotting the
temperatures for < month > , < year > , alternating asterisks (highs) with
hashes (lows), e.g.
**********
####
************
#####
Sort the array by date, city, or high or low temperature.
Print average high temp at < location > between < day > , < month > , < year > and < day > , < month > , < year > .
Code all features to here for a maximum grade of 80.
Write the current data to a new file. The data should be sorted
by date before being written to the file, but don't perform a sort
unless it is necessary. The data should be in the same format that
you read in, so that you can read a data file once you've written
it.
Make your array of structs 10 larger than what gets read
in. Give the user the option to add data for a new day, and prompt
the user for the new data, one prompt each for date, high, low, and city.
Code all features to here for a maximum grade of 90.
Have a variable in main() that stores how the data was last
sorted (it is sorted by date when you read it in). Any functions
that rely on sorted data (for example, functions that expect all the
temperatures for a month to be together) must check to see if the
data is correctly sorted by checking this variable; if not, they
re-sort the data and change the variable value (it will be
pass-by-reference using pointers). All functions that can use sorted
data to short-circuit their data search must do so.
Code all features to here for a maximum grade of 100.
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."
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 and start early. Think about how you can break the program into
pieces, and code each piece before you try putting the
parts together. A possible approach:
Review the example code online and your labs before you try to
code a function.
Submission
Design and test your program carefully! Check the calculations!
Shortly before the project is due you will be given new 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 (Monday).
File translated from
TEX
by
TTH,
version 3.38. On 16 Nov 2006, 13:40.