CIS 1057: Homework 12

Handed out: 11/16/10
Due: by 10:00pm on 12/07/10
Email program to TA.

Your program deals with files of student records:
    #define NAMESIZE 20
    struct student{
       char lname[NAMESIZE];  // lastname
       char fname[NAMESIZE];  // firstname
       int  mid;
       int  final;
       int  hmwks;
    };
We assume that all the records have different last names.

Your program will display to the user the following menu:

	1. Sort a file
	2. Merge two sorted files
	3. Query a sorted file
	4. Display a file, including the scores of the students
	5. Quit
	Enter your choice: 
If the choice is 1, 2, 3, or 4 the corresponding action will be taken. Otherwise the user will be asked if to quit or continue.

If the choice was 1., the user is asked to enter the name of a file containing unsorted student records and of the file where to store such records in sorted order. Then the action is carried out.

If the choice was 2., the user is asked to enter the name of two sorted files of student records and the name of the merge file that has to be created. Then the action is carried out.

If the choice was 3., the user is asked to enter the name of a (sorted) file of students. Then in a loop the user is asked for the last name of a student and the correspondent record is printed out if present in the file. Otherwise an apology is given. The loop terminates when the null string is entered.

If the choice was 4., the user is asked to enter the name of a file of students. Then the student information is printed out together with a score computed with weight 50% for the final, 30% for the homeworks, and 20% for the midterm.

Here are two unsorted files of students records that you may use to test your program: students1.txt and students2.txt

As a comment at the beginning of your program you should do a case analysis for this problem: problem statement, analysis, design, implementation, and testing.