{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


Fall2009-assignment8 - Programming Systems Design CSCI 455...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming Systems Design CSCI 455 FALL 2009 Dr. K. Narayanaswamy Programming Assignment # 8 Due Date: 11/8/2009 (11:59:59 p.m.) Goal This assignment has all the same external requirements as Assignment 6, but we require you to implement the database as a collection of CLASS objects. Like Assignment 6, Assignment 8 will allow you to add students and delete students from the collection. In this Assignment, you will also implement binary search to search the database – so the collection will need to be maintained in sorted order. Task The program will manage a database of Student objects. As in Assignment 5, 6, and 7, the following are the attributes of a student: Last name: a string with only alphabetic characters. For formatting purposes, you may assume the names would be no longer than 15 characters; First name: a string with only alphabetic characters. For formatting purposes, you may assume the first name would be no longer than 15 characters; Social Security Number: a string. The social security numbers you accept must be 11 characters, with digits in positions 1, 2, 3, 5, 6, 8, 9, 10 and 11; and the “-“ in positions 4 and 7. Phone Number: a string. A valid phone number will be of length 13, and will contain characters “(“ in position 1, “)” in position 5, and “-“ in position 9. All other characters must be digits. Age: an integer. You may assume this field will always be an integer, but the age must be a positive integer. Your program will support the following single character commands in a main command loop: “I” or “i” (Import Command) Prompts the user for a file name, and will initialize the database from the student data in that file. That means that existing database contents will be wiped out completely and re-initialized when this command is executed. The data in the array must be maintained in sorted order – sorted by
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
social security number. The command should check for and report errors as the input file is processed. The format of the data and error checking requirements are identical to that in Assignment 5, 6, and 7. In all cases, IF there are any problems with the input, you should report the problem to the terminal to make the user aware with a line number on which the problem arises. You should also specify what action was taken with the input. You may assume the input will have the above items in the order stated in the input file. You do not have to do error checking beyond what is indicated explicitly in the assignment requirements. “A” or “a” (Add Command) Add a Student to the database you are maintaining – your program should prompt for each of the student attributes (such as social security number, last name, first name, phone, and age). Make sure that the attributes provided as values satisfy the requirements – e.g., social security number must be valid, age must be positive, and so on. Once all the data is validated, your program should add the new student to the existing database if there is no duplicate social security number. It is critical that the addition preserves the sorted order.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}