Question
Project Challenge: Split Check Calculator Learning Objectives: 1. Apply variables and expressions to problem solving. 2. Write a program that takes input from the user.
Project Challenge: Split Check Calculator
Learning Objectives: 1. Apply variables and expressions to problem solving. 2. Write a program that takes input from the user. 3. Apply sequence to problem solving.
DIRECTIONS Write a program to calculate the amount each person must pay toward the bill and toward the tip, for a group of friends who are eating out together. Since you are all friends, it is okay to split the costs evenly.
Your program should take as input: 1. The restaurant bill (without tax or tip) as a floating point number 2. The sales tax rate as a floating point number (for example: an 8% tax rate would be 0.08) 3. The level of service as an integer between 0 and 10
0 is terrible (0% tip), 5 is average (15% tip), and 10 is excellent (30% tip)
4. The number of friends to split the check among
Your program should output: 1. The amount each friend should pay toward the bill (with tax) 2. The amount each friend should leave in tip
tip should be calculated on the pre-tax restaurant bill
3. The total amount each diner should pay, including restaurant bill, sales tax, and tip 4. The overall total, which includes the restaurant bill, the sales tax, and the tip.
For example, with the following inputs:
Restaurant bill (without tax or tip): 35 Sales tax rate: 0.08 Level of service: 7 Number of friends: 3
The output should be: Bill (with tax) per person: 12.6 Tip per person: 2.4499999999999997 Total per person: 15.049999999999999 Total bill including tax and tip: 45.15
Note that because floating point values often incur rounding errors, the output might not be completely accurate. This will not affect the grading. However, please make your input and output look like the example above, so that the automated system can evaluate your results.
Things to think about when youre writing these programs: 1. Follow the recipe: collect all your input first; then calculate the required results; then output the results.
2. Spend some time choosing your variable names carefully. Names should be descriptive. 3. Take advantage of variables to name values whose purpose may not be obvious. 4. Take advantage of variables by breaking any complex expressions down into a set of simpler expressions and storing the intermediate results in variables
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started