Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your first programming assignment is to design a program that does the following

ID: 3847132 • Letter: Y

Question

Your first programming assignment is to design a program that does the following: Add comments at the beginning of your program with your name, “CIS 251”, and “Chapter 2 Programming Assignment”. You are going to create a bill calculator to aid the servers at a restaurant. Choose the name of an existing restaurant (or make up your own). Write the C++ code to print the name of your restaurant at the top of the screen. Print a blank line, and on the third line, print “Bill Calculator”. Prompt the server to enter the bill amount and read this value to a variable of type double. Prompt the server for a tip percentage and read this value to a variable of type double. Create a tax rate variable of type double. Assign it the value of 9% (note that % has a special meaning in C++, so you will not use this symbol to do this). Display to the server, the bill amount and the tip percentage entered, as well as the tax rate percentage. After that, make the necessary calculations. Create any double variables or other variable types as needed (use doubles rather than floats for all of your money and percentage needs). Display the Tax amount and the Tip amount (your program will calculate these values). Finally, display “Total Amount Due” (label it so the customer knows what to pay) and your final calculation. Add “$” and “%” characters to your program output where applicable. NOTE: You will have to multiply and divide by 100 in order to work with the tax rate and tip rate, otherwise your calculations are going to be way off. bill: $20; Tip: 20%; Tax: $1.80; Tip: $4.36; Total: $26.16 bill: $40; Tip: 20%; Tax: $3.60; Tip: $8.72; Total: $52.32 DO NOT HARD CODE SAMPLE INPUTS IN YOUR PROGRAM! READ THEM FROM THE KEYBOARD!

Explanation / Answer

Here is the code and output. Please don't forget to rate the answer if it helped. Thank you very much.

#include <iostream>
using namespace std;
int main()
{
double bill, tax_rate = 9, tip_rate, tax_amt, tip_amt, total;

cout << " Welcome to Tasty Food Restaurant" << endl << endl;

cout << "Enter bill amount : $" ;
cin >> bill;
cout << "Enter tip rate(%): ";
cin >> tip_rate;


tax_amt = bill * tax_rate / 100;
total = bill + tax_amt;
tip_amt = total * tip_rate / 100;
total = total + tip_amt;

cout << " Bill: $" << bill << endl;
cout << "Tip rate: " << tip_rate << "%" <<endl;
cout << "Tip: $" << tip_amt << endl;
cout << "Tax: $" << tax_amt << endl;
cout << "Total: $" << total <<endl ;
return 0;
}

output

Welcome to Tasty Food Restaurant

Enter bill amount : $40
Enter tip rate(%): 20


Bill: $40
Tip rate: 20%
Tip: $8.72
Tax: $3.6
Total: $52.32

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote