CMSC104, Fall 2004

Programming Project 2

Restaurant Helper


Out: Wednesday, November 10, 2004
Due: Wednesday, November 24, 2004 before midnight


The Objective

This project is designed to give you practice with nested for loops and switch statements

The Task

When eating a meal in a restaurant, it is inevitable that the check will come and some questions will arise. How much should I tip? Or even worse, when dining with a group, how much should each person pay? A popular software company has decided to develop a product to help people in this difficult situation. You have been asked to develop the beta version of the software. Your software should allow the user to print out a handy table to help determine the tip, add a tip to the total, and also split the check.


Specific Details


Sample Output

linux1[23]% gcc -ansi -Wall proj2.c
linux1[24]% a.out
 
Your greeting goes here.
 
Please enter the total check amount: 5
The total must be between 10.00 and 100.00
Please enter the total check amount: 150
The total must be between 10.00 and 100.00
Please enter the total check amount: 100
 
P - Print the tip table
A - Add the tip
S - Split the check
E - Enter a new total check amount
Q - Quit
 
Enter your menu selection: P
 
   Tip Calcuation Table

Amount     15%    20%    25%
    10    1.50   2.00   2.50
    15    2.25   3.00   3.75
    20    3.00   4.00   5.00
    25    3.75   5.00   6.25
    30    4.50   6.00   7.50
    35    5.25   7.00   8.75
    40    6.00   8.00  10.00
    45    6.75   9.00  11.25
    50    7.50  10.00  12.50
    55    8.25  11.00  13.75
    60    9.00  12.00  15.00
    65    9.75  13.00  16.25
    70   10.50  14.00  17.50
    75   11.25  15.00  18.75
    80   12.00  16.00  20.00
    85   12.75  17.00  21.25
    90   13.50  18.00  22.50
    95   14.25  19.00  23.75
   100   15.00  20.00  25.00
 

P - Print the tip table
A - Add the tip
S - Split the check
E - Enter a new total check amount
Q - Quit
 
Enter your menu selection: A
 
Enter the tip: 20.00
The total amount of your bill with tip included is $120.00.
 
 
P - Print the tip table
A - Add the tip
S - Split the check
E - Enter a new total check amount
Q - Quit
 
Enter your menu selection: S
 
How many ways would you like to split the check? 2
 
If you split the check 2 ways, each person should pay $60.00.
 
 
P - Print the tip table
A - Add the tip
S - Split the check
E - Enter a new total check amount
Q - Quit
 
Enter your menu selection: e
 
Enter a new total amount: 20.50
 

P - Print the tip table 
A - Add the tip
S - Split the check
E - Enter a new total check amount
Q - Quit
 
Enter your menu selection: P

   Tip Calcuation Table
 
Amount     15%    20%    25%
    10    1.50   2.00   2.50
    15    2.25   3.00   3.75
    20    3.00   4.00   5.00
    25    3.75   5.00   6.25
    30    4.50   6.00   7.50
    35    5.25   7.00   8.75
    40    6.00   8.00  10.00
    45    6.75   9.00  11.25
    50    7.50  10.00  12.50
    55    8.25  11.00  13.75
    60    9.00  12.00  15.00
    65    9.75  13.00  16.25
    70   10.50  14.00  17.50
    75   11.25  15.00  18.75
    80   12.00  16.00  20.00
    85   12.75  17.00  21.25
    90   13.50  18.00  22.50
    95   14.25  19.00  23.75
   100   15.00  20.00  25.00
 
 
P - Print the tip table
A - Add the tip
S - Split the check
E - Enter a new total check amount
Q - Quit
 
Enter your menu selection: a
 
Enter the tip: 4.00
The total amount of your bill with tip included is $24.50.
 
 
A - Add the tip
P - Print the tip table
S - Split the check
E - Enter a new total check amount
Q - Quit
 
Enter your menu selection: q
 
I hope you enjoyed your meal!!

Submitting the Program

Here is a sample submission command. Note that the project name starts with uppercase 'P'.

submit cs104_0201 Proj2 proj2.c

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show the file that you submitted in a format similar to the Unix 'ls' command.

submitls cs104_0201 Proj2