Question: You've been asked to write a pricing app for a friend who opened a new eating establishment. At this place customers are charged by the

You've been asked to write a pricing app for a friend who opened a new eating establishment. At this place customers are charged by the weight of the food eaten. Your program needs to determine the price based on the weight of the food eaten, using the following pricing model:
If the customer eats less than 3 pounds of food the price is $11.99; if the customer eats up to and including 3.9 pounds of food the price will be $16.99. If the customer eats up to and including 4.9 pounds of food the price will be $21.75. If the customer eats more than that the price will be $27.99.
Your general logic should be something like this: Prompt the user for customer name and pounds of food eaten by that customer. Calculate the subtotal based on that weight, then add 7.25% sales tax, then output the customer name, pounds eaten, subtotal, tax, and total amount due.
Example output:
Customer name:
Pounds eaten:
Subtotal:
Tax:
Total amount due:
Ms. Creosote
3.1
$16.99
$1.19
$18.18
Use only NAMED CONSTANTS for ALL constants in the program! (see 2.1.4). Remember that the weights, prices, and sales tax rate are all constants in this program.
Your decision logic should use Multiple Alternatives (see 3.4).
Pay close attention to which weight cutoffs are associated with which charges (look for words like "up to and including" versus words like "less than") and use the appropriate relational operators (see 3.2).
Test your program with several representative values to verify that the logic works, then submit it showing output for the following two amounts of food eaten: 2.5 pounds and 4.7 pounds.
 You've been asked to write a pricing app for a friend

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!