Reference Parameters & Files (Restaurant Bill)
- Initial Deadline:
- 11:00pm, Friday November 12, 2021
Description
You are to rewrite programming assignment 4 (Restaurant bill program) to use reference parameters and files. Do the following:
- Add a function to your program that will ask the user for the name of the data file. The function will then attempt to open the file. If the open fails, the program should report this fact and quit.
- Read in the number of people at each table from the file using a function (if you haven’t already done this).
- Change the function that reads and sums the costs so that the costs are now read from the file.
- Change the calculation functions so that there is now only one function that will do all three calculations (tax, tip and total).
- There is no longer a sentinel of 0 people. The program should now process data until it reaches the end of the file.
Each table is associated with two lines in the data file. The first line contains the number of people at the table. The second line contains all the costs for that table. You do not know how many tables are there. There is no sentinel.
Additionally, you must include the following requirements for this project:
As part of the test plan in the
program_plan.txt
document, include at least three test cases, with at least one consisting of invalid values/resultsDocument the following aspects of your program:
- Variable declarations
- Arrays
- Complex formulas
- User-defined functions
- System functions
- Parameters
- Each logical block of code explaining decisions and code functionality