Intro to Programming in C  Assignment 4

Intro to Programming in C Assignment 4

Intro to Programming in C  Assignment 4

Since this is the last assignment, there will be no late submission.

All programs must be electronically submitted by 5:00pm on Tuesday, December 2nd with NO EXCEPTIONS in order to receive a grade.

With this assignment you will start to learn how to write a practical menu driven program that manages a list of data and implements a rudimentary database. You will use an array of structs to organize the data and you will read and save the information in a text.

The assignment is to write a menu driven program that manages a hotel registration system.  You will use a structure to store the following customer information:

Customer First Name

Customer Last Name

Customer ID

Room #

Customer Current Charges (dollars and cents)

Customer Room Charge Limit (dollars and cents)

(Please remember that your structure must define member types that are appropriate for the given data!)

Your menu commands will include:

    C)  Customer Check-in

    O)  Customer Check-out

    L)  Customer List (to the screen)

    D)  Delete all customers

    A)  Add a Customer Room Charge

    Q)  Quit
Implementation Details:

·       When the program begins, it will read the customer data list from the database (text file)

·       When a new customer checks in, the program will ask the user for each of the fields on a separate line.  The program must check to make sure a customer with the same ID does not already exist!

·       When a customer checks out, the program will ask you for the customer id of the customer who is checking out.  Locate the entry in the array and remove all of the data for that entry. The list does not need to be sorted – to remove an entry, you may move the last item in the list to the location of the deleted entry.  The program must handle if the customer is not found.

·       When you display the customer list on the screen, all of the information stored for each customer will be labeled and displayed.

·       Deleting all customers “deletes” all of the information in the array by resetting each value to an appropriate default value.  Remember this means setting the customer id to -1.

·       When adding a customer charge, the program will ask for the customer id whose account the charge will be added to.  The program should add the new charges to the old one and update the current room charges for the given customer (don’t worry about going over the room’s charge limit!).  The program must handle if it cannot find the given customer id.

·       When the program exits, it will write the current list to the database (text file).

Instructions:

·       You should use at least 10 user-defined functions (plus main) to appropriately break the problem up into smaller pieces.

·       You need to begin the program by reading the records from the database and displaying the number of records read in.  After this the menu should be shown.
·       You must use function prototypes and NO global variables.

·       You must use a #define to set the upper bound of the list to at least 20 entries.
·       Your code should be well designed, well commented and written with good style. 

Other Important Hints and Reminders:

·       Start work on this as soon as possible.  We will work on it in class but DO NOT rely on this – we most likely will get sidetracked in discussions as they arise.

·       You are expected to receive as much help as you need for the basic assignment.
·       It is your responsibility to request this help in the form of specific questions.

·       You may ask these questions by sending them via email to me or the lab TAs.

·       When you ask a question, it should be specific, and you should provide the current version of your program.

·       The current version of your program should be neatly formatted and commented. It should also be properly indented and use meaningful variable and function names. This will make it easier for anyone helping you to understand what you are trying to do.

 

NOTE: there will probably be no assistance with this assignment on the last weekend before the assignment or the morning it is due so DON’T leave this assignment to the last minute.
Powered by