Your second programming assignment is to design a program that does the followin
Your second programming assignment is to design a program that does the following:
Add comments at the beginning of your program with your name, date, class, and “Chapter 3 Programming Assignment”. Also use comments to document your code: tell what your variables do, explain difficult sections of code, and explain what the overall program does.
You are going to modify the program you created for Chapter 2 to add some functionality and improve readability.
Declare a string constant that will hold the name of your restaurant. You will use this constant to print the name of your business in a few places in your output.
Declare a fractional constant to hold the 10% tax rate. You will use this to print the tax rate and to calculate the tax amount for the bill.
Create a string variable to hold the name of the server. After you print the menu, have the user enter his/her name that is read into this variable. Use ONE variable that has the ability to read the server’s first, middle, and last names separated by spaces. Make sure the name is read and not skipped.
Modify at least one of your calculations to use a combined assignment operator (+=, -=, *=, /=, %=). What this does is up to you, but you have to use at least one. Label this with a comment so that I can see that you completed the requirement.
Using Input/Output manipulation discussed in Chapter 3, use the setw() operator to print your receipt in a more aesthetically pleasing format that lines up all your numerical entries regardless of the number of decimal places used in your input values. Also make sure that all of your price values are rounded to two decimal places.
Print your tax and tip percentages with a “ %” sign following. I would like for you to static cast these to integer so that they have NO decimal points.
Generate a random integer using either the cstdlib or random include file. Select a random value between 1 and 20 to be the table number where the customer is sitting.
Print a message after calculating the bill that looks similar to the following:
Thanks for dining with us at ! Your Table Number is You were served today by: Come back to see us soon!
At the end of your program, prompt the user to “Press [Enter] to continue.” Use a function that we discussed in Chapter 3 that can grab a whitespace character.
Submit your program source code to the Blackboard submission module as a Word document. Include a screen shot of your output (Ctrl-Alt-Print Screen) as well.
This program is worth 50 points.
Sample Inputs to check:
Input: bill: $5; Tip: 15; Output: Tax: $0.50; Tip: $0.82; Total: $6.33 Input: bill: $7.5; Tip: 20; Output: Tax: $0.75; Tip: $1.65; Total: $9.90
DO NOT HARD CODE SAMPLE INPUTS IN YOUR PROGRAM! READ THEM FROM THE KEYBOARD!
CIS 251 Chapter 3 Programming Assignment Checklist
Initial Comments: Name, Date, Class, Assignment (2 points)
Documentation: comments for variables, what your program does, and difficult sections of code (5 points)
Constant restaurant name and constant tax rate (2 points)
Server’s full name including spaces read into an appropriate variable (5 points)
Combined Assignment operator in your calculations (5 points)
Setw() formatting and two decimal point money values (5 points)
Percentage static casting for tip and tax (5 points)
Random table number generated (5 points)
Formatted message with restaurant name, server name, and table number displayed (3 points)
“Press [Enter] to continue” message with a character read after (3 points)
Does your program compile? (-10 points)
Does your program output have correct calculations that match my samples? No one wants to use a broken calculator. (10 points – I can’t give credit if your program doesn’t compile)
I uploaded an example when the program is ran.
Use these drinks Pepsi, MountainDew, DrPepper, Sunkist, Grapico, GingerAle, Sprite, Coke