Jerry Feingold wants a program that will help him calculate the amount to tip a
ID: 3882776 • Letter: J
Question
Jerry Feingold wants a program that will help him calculate the amount to tip a waiter at a restaurant. The program should subtract any liquor charge from the total bill and then calculate the tip (using a percentage) on the remainder. Finally, the program should display the tip on the screen. Desk-check your solution's algorithm using $85 as the total bill, $20 as the liquor charge, and 20% as the tip percentage. Then desk-check it using $35 as the total bill, so as the liquor charge, and 15% as the tip percentage. (See Appendix B for the answer.)Explanation / Answer
c++ code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout << "Enter Total Bill in dollars! ";
float Total_bill;
cin >> Total_bill;
cout << "Enter liquore charge! ";
float liquore;
cin >> liquore;
cout << "Enter tip percent ";
float percent;
cin >> percent;
float tip = (Total_bill - liquore)*percent/100;
cout << "---------------------------------------------- ";
cout << "Tip_amount = " << tip << " dollars!" << endl;
return 0;
}
Sample Output1:
Enter Total Bill in dollars!
85
Enter liquore charge!
20
Enter tip percent
20
----------------------------------------------
Tip_amount = 13 dollars!
Sample Output2:
Enter Total Bill in dollars!
35
Enter liquore charge!
0
Enter tip percent
15
----------------------------------------------
Tip_amount = 5.25 dollars!
Note: If you want the code in any other prgramming language then comment below, I will write the code!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.