CSC 533: Organization of Programming Languages
Fall 2002

HW1: C++ Programming

Implement a price tansaction system, as discussed in class. Your program should access a file that stores an inventory of items and their prices. It should then prompt the user for a sequence of items to be purchased, and display the total price for those items.

For example, consider the following menu for a restaurant:

bean-burger $2.99 tofu-dog $2.49 fries $0.99 medium-soda $0.79 large-soda $0.99

If the user entered an order of a tofu dog, fries, and large soda, then the program would display the total price of $4.47.

The inventory of items, whether it be a restaurant menu or a movie database, must be stored in a file, although the exact structure of that file is up to you. In addition, you have freedom in designing the I/O interface and data structures for storing and retrieving prices. However, your interface should be clear to the user so that they know how to enter the items, and your data structures should provide reasonable access to the required data. Your grade for the assignment will depend not only on its correctness, but also on the elegance of your code.

If you would like a quick review of useful C++ classes and libraries (some of which may be new to you), see CSC533 REVIEW SHEET: C++ Classes & Libraries.