Homework 5
Student Record Database

Due: Tuesday, December 4 at 11:59pm

Outcomes

After successfully completing this assignment, you will be able to...

Before Starting

Read Chapters 10 and 11

The Assignment

The Registrar's office at a small college keeps records on each of its students. Each record contains the student's name, the student's major, and the student's grade point average. Students are stored in the database according to student id number, where id numbers can be in the range 0 to 99. Write a C program that initializes the file "students.dat" to 100 empty student records, and lets the user add, delete, and list records, as well as change the grade point average or major for a given student. The student id corresponds to the record number in the file.

Assumptions and restrictions

Include files

Sample execution

*** Student Database Program ***

The database has been initialized with 100 empty records.

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  1
Enter the student ID:  24
What is the name of the student?  John Smith
What is the student's major?  IMGD
What is the student's GPA?  3.5

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  1
Enter the student ID:  3
What is the name of the student?  Vijay Singh
What is the student's major?  ECE
What is the student's GPA?  3.8

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  2

***       Student Database    ***

   3  Vijay Singh        ECE  3.8

  24  John Smith         IMGD 3.5

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  3
Enter the ID of the student:  3
The student record for student 3 has been deleted.

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  2

***       Student Database    ***

  24  John Smith         IMGD 3.5

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  4
Enter the ID of the student:  24
Enter 1 to change the student's major, or 2 to change the student's GPA:  2
Enter the new GPA:  3.3

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  2

***       Student Database    ***

  24  John Smith         IMGD 3.3

What would you like to do?
Enter
    1  to insert a new student into the datatbase
    2  to list all students in the database
    3  to delete a student from the database
    4  to update the information about a student in the database

Type any other number to quit

-->  0

Program terminating.

Hints

Get the main program structure working first (i.e., in a loop display the menu and accept the user's response; terminate the program when the user types a number other than 1, 2, 3, or 4). Then, one at a time, implement each of the four operations.

Deliverables

Submit your file using the following turnin command:

/cs/bin/turnin submit cs2301 hw5 hw5.c

Programs submitted after 11:59pm on December 4 will be tagged as late, and will be subject to the late homework policy.

Grading

This assignment will be graded on the following areas: documentation (including pre- and post-conditions for any functions), and correctness. Programs must compile successfully in order to receive points for correctness.