Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Your program should meet the same specifications as in Assignment #1, with the following additions: 1)Modify the code to use functions Changing to use functions is a major deliverable of this...

1 answer below »

Your program should meet the same specifications as in Assignment #1, with the following additions:

1)Modify the code to use functions

Changing to use functions is a major deliverable of this assignment. You should look to break down your code as much as is reasonably possible into different functions (ie. tasks).Remember, functions allow for easier troubleshooting and re-use, so the more we break things down the better we are able to isolate our code and be able to potentially use code over again. We are aiming for a minimal amount of code in the main section (ie. outside any function) that isn't calling functions.

YOU MUST PASS INFORMATION TO YOUR FUNCTIONS AS PARAMETERS (vs. code in functions referencing variables created outside the function) AND GET BACK ANY DATA FROM THOSE FUNCTIONS AS RETURN VALUES, AS SHOWN IN THE NOTES ON FUNCTIONS.

THE REMAINING CODE (OUTSIDE THE FUNCTIONS) WILL CONTROL THE LOGICAL FLOW FO TEH PROGRAM BY CALLING DIFFERENT FUNCTIONS WHEN/AS NEEDED. IT WILL ALSO PASS THE RIGHT (EXPECTED) ARGUMENTS TO THE FUNCTIONS (in function calls) AND SAVE/USE IN THE OUTPUT (where applicable) ANY OF FUNCTIONS' RETURN VALUES.

2)This is another major deliverable of this assignment: adjust your code to use lists and dictionariesfor data storage as appropriate (if it is relating information about one thing, a dictionary would be likely appropriate. If it is several related things, a list is appropriate).

  • Have the meals that can be purchased stored in a nested dictionary. Have 6 items (of your choice) on the menu. User should picked a meal by typing a number associated with the meal type. It is still OK for a given order to just have one type of meal (for now).
  • And, have the meal ordered and the related order info stored in an appropriate dictionary.

Hint: so, there should be 2 dictionaries, at least. One holding the meals available. Use it to display the menu (with prices). And a second one storing ALL of the order information (e.g. meal selected, its price, quantity ordered, discount or not, hst - and everything else that is related to the order made by the customer).

  • Use a collection data type (a list or a dictionary) to store customer info (name, address, etc) as well.

3)Change your code to use loops to have*ALL* prompts repeat until a valid value is entered.

  • You do not have to do error checking against something that would cause an exception/crash, yet.
  • You should ensure that everything has a value: do only basic content checking of strings with what you know (ie. minimum or maximum lengths, comparison, etc). Hint: Sounds like something that should be a function so you can keep reusing it.

4)Have the user indicate if the order is for pickup or delivery. Show this in a sensible place on your receipt. Customer's address and delivery instructions should display on the receipt only if order is for delivery. Customer name and phone number should display in either case.

5)Add a delivery charge of $5, but waive it on orders totaling (after discount, before HST, and before tip) $30 or more. Show this only on delivery orders. If waived, indicate it is waived; if not, have it on the order.

6)Have a choice to tip the delivery person 10, 15, or 20%. Must be one of those, entered as a number. Only applies to delivery. Show only on receipts for delivery.

7)Ensure that all information that is configurable is stored in variables (discount %, discount thresholds, HST %, tip choices (hint: use a List), delivery charge) - rather than hardcoding it in your code.

8)Notes on calculations:

- Delivery tip is calculated on subtotal before HST.
- There is no HST on delivery charges.
- There is no HST on the tip either.

Answered 4 days After Feb 28, 2022

Solution

Arun Shankar answered on Mar 03 2022
96 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here