CSci 131 - Algorithms and Data Structures I
Software Project #2
Due Date: February 23, 2000
In this project you will develop a very simple student record database. The general structure is based strongly on the employee database discussed in Chapter 3 of the textbook; before proceeding, read that chapter thoroughly and understand the structure of the employee database! You have two weeks to complete this project; if you start immediately, you will have time to complete it. Following steps 1-6 below will help you learn how do to "unit testing", and will, in general, save you much time compared to trying to find a bug after you integrate all the parts together.
A. Develop a package to handle student data, using Employees as a model. Complete the following package specification and write the corresponding package body. This specification can be found in the programs131 directory as students.ads.
WITH Currency; WITH Dates; PACKAGE Students IS ------------------------------------------------------------------ --| Partial specification for ADT package to handle Student records --| Author: Michael B. Feldman, The George Washington University --| Last Modified: February 2000 ------------------------------------------------------------------ TYPE Student IS PRIVATE; SUBTYPE GradePoint IS Float RANGE 0.0..4.0; SUBTYPE IDRange IS Integer RANGE 0000..9999; MaxNameLength: CONSTANT Positive := 15; SUBTYPE NameRange IS Natural RANGE 0..MaxNameLength; SUBTYPE NameType IS String(1..MaxNameLength); FUNCTION MakeStudent(Name: NameType; ID: IDRange; BirthDate: Dates.Date; TotalTuition: Currency.Quantity; TuitionPaid: Currency.Quantity; GPA: GradePoint) RETURN Student; -- Pre: all input parameters are defined -- Post: returns a Student record with the fields filled in FUNCTION RetrieveID(OneStudent: Student) RETURN IDRange; -- Pre: OneStudent is defined -- Post: returns the ID field of OneStudent -- Add one retrieve function for each field PRIVATE TYPE Student IS RECORD Name: NameType := (OTHERS => '.'); NameLength: NameRange := 0; ID: IDRange := 0000; BirthDate: Dates.Date; Tuition: Currency.Quantity; AmountPaid: Currency.Quantity; GPA: GradePoint; END RECORD; END Students;B. Write a package, both specification and body, for Students.IO that contains file and interactive Get and Put procedures. Use Employees.IO as a model.
C. Develop a test plan for Students and Students.IO; write and test the corresponding test program.
D. Modify the Tables package in the textbook, program 3.11 (specification) and program 3.14 (body) so that it contains student information, not employee information. The student ID should be the key field. Complete any unfinished parts of the package body.
E. Develop a test plan and test program to test the modified tables package.
F. Finally, make any necessary modifications to Employee_UI (program 3.16) so that it can be used as the user interface for the student database.