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?

1  General Idea

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:
  1. Print highest temp in all data

  2. Print lowest temp in all data

    Code all features to here for a maximum grade of 60.



  3. Print data for one month with nice headers and formatting.

  4. Print highest temp in < month > , < year >

  5. Print lowest temp in < month > , < year >

  6. Print average high temp in < month > , < year >

  7. Print average low temp in < month > , < year >

  8. 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.

  9. 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.



  10. Print highest temp for < location > in < month > , < year >

  11. Print which location had the highest temp in < month > , < year >

  12. Allow the user to replace existing data in the temperature array for a given day, month and year.

  13. Make a bar chart (horizontal) plotting the temperatures for < month > , < year > , alternating asterisks (highs) with hashes (lows), e.g.
    **********
    ####
    ************
    #####
    
    


  14. Sort the array by date, city, or high or low temperature.

  15. 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.



  16. 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.

  17. 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.



  18. 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

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.