Python Billing Application

You own a restaurant. In your restaurant, you sell the following:

Hamburger $3 each

Hot Dog $2 each

Milk Shake $3 each

 

Start by writing a function with a name like calculateBill that will do the following:

 

- Allow the caller to pass in three parameters:

    1.the number of hamburgers to buy

    2.the number of hot dogs to buy

    3.the number of milk shakes to buy

 

- Calculate the subtotal of this purchase, by doing some simple math.

- Add 10% of that amount for tax, to get a total

- it should return the total amount for the purchase

- The calculateBill function should NOT print anything, only the main code should do the printing.

 

Then write 3 calls to the function:

The first two calls should use different amounts of hamburgers, hot dogs, and milk shakes. To verify that your function works correctly, test with these values:

    3 hamburgers, 2 hot dogs, and 1 milk shake.

    This order should come out to (16.00 plus 1.60 tax) 17.60.

 

    8 hamburgers, 8 hot dogs, and 8 milkshakes

    This order should give a cost 70.40

 

To prepare for the third call, you need to add some interactivity. Ask the user three questions to get the number of hamburgers, hot dogs, and milk shakes they want to order (reminder: to get input from the user, use the input built-in function). Then the third call to the calculateBIll function should use the numbers you got from the user.

After each call to the function, add a line to print out the resulting bill, for example:

Your bill is: $123.45

 

Do NOT worry about the number of decimal places shown. For example, in the first example above with 3 hamburgers, 2 hot dogs, and 1 milkshake, the total will probably print as 17.6 - that is OK.

 

Need a custom answer at your budget?

This assignment has been answered 2 times in private sessions.

Or buy a ready solution below.

Buy ready solution

Solution previews

© 2024 Codify Tutor. All rights reserved