FINAL PROJECTS

The final exam will consist of 3 programming projects. They are due at 6:30 pm on Friday, 5/9.

Part I: Programming project # 3 on page 416 of the texbook. (Enhance the car-wash simulation program).

You may use all the files provided for the car-wash simulation of Chapter 8.

Part II:

ALL THE FILES YOU NEED FOR THIS PART ARE PROVIDED IN THE FOLDER "FINAL". COPY THOSE FILES INTO YOUR OWN FOLDER AND WORK ON THE COPIES. DO NOT MODIFY THE GIVEN FILES.

The Assignment:
Implement the bag template class from Section 10.5, using a binary search tree to store the items.
Purpose:
Ensure that you understand and can use binary search tree.
Before Starting:
Read all of Chapter 10, especially Sections 10.3 and 10.5.

Files that you must write:
bag6.h: Header file for this version of the bag class. You don't have to write much of this file. Just copy the given version and add your name and other information at the top.
bag6.cpp: The implementation file for the new bag class. Much of the file has already been written for you. Just complete the necessary parts (which are labelled "STUDENT WORK")

Other files that you may find helpful:
bintree.h: and bintree.cpp This is the binary tree node template class from Section 10.3.

bagtest.cpp: A simple interactive test program.

Part III

Write a program which reads input from a file and constructs a linked list that contains data in sorted order of employee ID's. Provide functions for adding, editing and deleting an employee into this list. Also provide functions for displaying information for a particular employee, for employees of a specific department or for all the employees.

You can assume that the input files to this program have the following format:

Number of employees

Employee ID 1

Last name of employee 1

First name of employee 1

Department of employee 1

Salary of employee 1

Employee ID 2

Last name of employee 2

First name of employee 2

Department of employee 2

Salary of employee 2

...

For instance a sample input file could be as follows:

3

74569

Peabody

Greg

Payroll

34000

69874

Huffman

Norman

Sales

38000

7017

Shorn

Lisa

Operations

39200


The program should ask for the name of the input file and then read data from this file. Assume that the user provides the file name including the full path name such as "P:\\class\\Math\\Aydin\\Teach\\Spring03\\Math218\\Sample.txt" The file can contain any (but specified on the first line) number of employee records. You must use a linked list for storing information. Each node in the linked list will be used to store information about a single employee. This linked list should be maintained in increasing order of employee ID numbers.

After the records have been read in, the program should print a menu and prompt the user for a choice from the menu. Once the program has processed the user's menu selection, it should display the menu again. This process should continue until the user chooses the Quit option. The menu should have the following selections:

1. Add a new employee to the list

2. Remove an employee from the list

3. Edit an employee's information

4. Display the information of an employee

5. List all employees in a specific department

6. List all the employees in ascending order of ID numbers

7. Quit the program

The tasks for the menu choices arre specified in more detail below:


Add a new employee record: The program should prompt the user to enter the employee's first name, last name, ID number, department and salary. After the user has entered the data, the program should insert a node for that employee into the linked list so as to maintain the sorted order of the list.

Remove an employee record: The program should prompt the user to enter the employee's ID number. The program should then search for the employee's record. If found, the program should delete the record from the list; if not found, the proram should print an appropriate message.

Edit an employee record: The program should prompt the user to enter the employee's ID number. It should then search that employee's record. If the record is not found, the program should print an appropriate message; if the record is found, then two things should happen: first the record should be displayed; second the program should prompt the user to enter new values. The program should then update the node to reflect these new values.

Display the record for an employee: The program should prompt the user to enter the employee's ID number. It should then search for the employee's record. If found, the program should display the record; if not found, it should print an appropriate message.


List the empolyees in a specific department: The program should prompt the user to enter a department name, then list the records of every employee in that department (or print a message that there are no employees for that department)

List all employees: The program should print out each of the employee records (or if there are no records in the list, it should report so). The records should be printed in the ascending order of ID's.