CS 1401 Assignment #12

Date Assigned: Monday, November 19, or Tuesday, November 20, 2007.

Due Date: Wednesday, November 28, or Thursday, November 29, 2007, before the beginning of your lab section.

Objective: The main objective of this assignment is to learn to handle exceptions.

Programming assignment: The task is similar to the previous Assignments 9-11: write a program for helping waiters. However, this time, we assume that all the data about the food items (their names, amounts, and prices) is already stored in a file food:

Example: For two food items, pizza and coke, the file has the following form:


Programming assignment (continued): the task is to read the values from this file into the corresponding array of objects (as in Assignment 10), and then print the detailed menu including the information about all the items plus the following information:

New part: If the file is empty or if one of the numbers in the file is negative, throw and handle appropriate exceptions -- and inform the user about the problem.

Clarification: in contrast to Assignment 11, there is no need to check whether the items are vegetarian or not.

Homework assignment: on a separate sheet of paper, solve Ex. 4 and 6 at the end of Chapter 12 (on pp. 799 and 800).

Deliverables: as instructed by your TA.