[Coding Exercise] Week 6 - A chef recommendation app

pdf

School

Simon Fraser University *

*We aren’t endorsed by this school

Course

120

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

4

Uploaded by xiaofanfan

Report
6/19/22, 12:56 PM [Coding Exercise] Week 6 - A chef recommendation app https://canvas.sfu.ca/courses/70584/assignments/777650?module_item_id=2544975 1/4 [Coding Exercise] Week 6 - A chef recommendation app Due Thursday by 11:59a.m. Points 0 Submitting a file upload File Types zip Available until Jun 24 at 11:59a.m. Start Assignment The owner of a new restaurant decided to provide customers with chef recommendations based on customers' ingredients preferences. The recommendations worked so well that they now want to create an automatic recommendation system. You will be developing an app to this avail! This app is a first request from the restaurant owner , where given a main ingredient there is only one possible dish, although a dish may be recommended given different main ingredients. This table shows what the available recommendations are, based on the main ingredient. The cost is associated to each dish. Main ingredient Recommendation Cost tomato spaghetti with tomato sauce 10.00 fish lemon butter fish 15.00 potato shepherd pie 13.50 lettuce Caesar salad 6.50 chicken roasted rosemary chicken 15.00 meat shepherd pie 13.50 pasta spaghetti with tomato 10.00
6/19/22, 12:56 PM [Coding Exercise] Week 6 - A chef recommendation app https://canvas.sfu.ca/courses/70584/assignments/777650?module_item_id=2544975 2/4 sauce cheese extra cheese pizza 6.50 YOU ARE ASKED TO: Create a Python chatbot that depicts the interaction with the customers at a table, first asking, for each table, the number of people, and then, for each customer at the table: the customer is asked what specific ingredient they would prefer. If the requested ingredient is not available, a 'special dish' will be recommended, with cost 15.00 If a generic vegetable is requested, the recommendation can be any dish whose main ingredient is any (randomly chosen) of the vegetables available as main ingredients. At the end of collecting all the orders the app should summarize the order for the table, and indicate the total cost. SAMPLE RUNS Sample run 1 Sample Run 2
6/19/22, 12:56 PM [Coding Exercise] Week 6 - A chef recommendation app https://canvas.sfu.ca/courses/70584/assignments/777650?module_item_id=2544975 3/4 REQUIREMENTS You must use a dictionary to store the counts of how many of each dish has been ordered. You must use a dictionary to store the correspondence from main ingredient to recommended dish. You must use a dictionary to store the costs of each dish. You must use a list to have the information of which main ingredients are vegetables. You must use at least one for loop to ask every customer at the table for their order. You must show a number (e.g. 1., 2. etc.) before each customer's order, beginning with 1 (See sample runs.) You must correctly show all the ordered dishes for the table. Your solution should use the accumulation pattern in the cost calculation. You must use the .format() method to output the final price with exactly two digits after the decimal point. Your solution must be robust to capitalization and initial spaces that the user may type. Your solution should handle unexpected main ingredient requests that are not among the recommended possibilities as indicated above. Remember to design your solution by first planning what your data structures will be (dictionaries, lists, special variables). Then plan, in English, the main steps of the algorithm, and then translate it to Python code. Include some comments (but not too many!) in your code. Make sure to include a header and use reasonable variable names, as usual. Test as you go! TWO VERSIONS 1) Version One should implement the Chef recommendation app as described above, where the dictionaries are hardcoded within the code, with the data as described in the table and description above. 2) Version Two (for bonus points, but highly recommended) should implement the Chef recommendation app as described above, where the dictionaries are dynamically created based on the chef.csv file available HERE (https://canvas.sfu.ca/courses/70584/files/19283828/download? download_frd=1) . Hint: You may want to add some element to some dictionaries to facilitate the processing of the "special dish", even if it does not have a specific main ingredient, perhaps by considering "special" as a main ingredient. Versions and submissions: Start working on version (1). Once it executes completely then you may want to start working on version (2), reusing most of version (1), except the creation of the dictionaries. Create a separate .py file for
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
6/19/22, 12:56 PM [Coding Exercise] Week 6 - A chef recommendation app https://canvas.sfu.ca/courses/70584/assignments/777650?module_item_id=2544975 4/4 each version. If you develop both versions submit the two Python files. Name the files so that it is clear with version it is, for example add to the .py file name _V1 or _V2. Whether you submit one or two .py files, do so within a zip file. Readability Guidelines Please check that your code follows the guidelines here: readability guidelines Submission Instructions Submit a .zip file containing your Python code. (If you developed both versions the zip file should include the two .py files. Do NOT include in the zip the chef.csv file) Make sure the filename/s do not contain any spaces ! If you wish to use multiple words for your filename, use an underscore to separate the words (e.g., my_program.py ) Make sure you also complete the separate Week 6 reflection activity! (same deadline as this assignment) Marking Notes If your program does not run (i.e. crashes or produces an error), your mark will be calculated using the rubric and then multiplied by 0.5. To avoid this penalty, try to finish early so you can get help from TAs if needed! It is better to submit code that works perfectly but doesn't contain all the features, than one that has all the features (potentially) but crashes. Each line of your code (including comments) should NOT exceed 100 characters. This is to help you develop a habit of good code formatting. In most cases you can break long code into separate steps, and some components that span multiple lines. You could also use intermediate variables to store parts of long messages to be printed (more situations will be seen as the course advances). If you are using offline IDEs like IDLE, you can look at the bottom of the editor which often tells you how many characters you have typed in a line (as COL's). If you are using Replit, first go to Settings on the left panel and set "Wrapping" to "none". Then use this sentence as a guide: # This line has exactly 100 characters (including the period), use it to keep each line under limit. The rubric will be posted later. Version 2 will provide bonus points.

Browse Popular Homework Q&A

Q: Statement 1: Viruses can spread faster than vulnerability-enabled worms Statement 2: A backdoor may…
Q: Give an example of a linear transformation whose image is spanned by 6 in R³. Be 8 sure to give some…
Q: Write a program that reads student data from a file, compute their GPA and writes the results to a…
Q: standard deduction last year was $12,550. Note: Leave no answer blank. Enter zero if applicable.…
Q: Write the net ionic equation  3CoI2(aq)+2K3PO4(aq)=Co3(PO4)2(s)+6KI(aq
Q: Use The Standard Normal Distribution Table to find the specified area under the standard normal…
Q: A stone of mass 3.7 kg drops from rest at a height of 7.67 m. What magnitude of impulse, J, does…
Q: OH A 1. NaH, THF (solvent) 2. CH₂CHCH₂Br В
Q: Complete the charge balance equation for an aqueous solution of H₂CO3 that ionizes to HCO3 and CO3-.…
Q: A force F(x) = bx³ acts on a potato as it moves along the x-axis from the origin to 4.1 m. How much…
Q: Risk Assessments can only be performed on specific chemicals or pollutants and there are still many…
Q: The solutions are hard to read. How to find Fh?
Q: 14. Explain why Mycoplasma and Mycobacterium are atypical cells and diseases caused by each
Q: Consider two vectors A and B such that Ã × B = B(A Find the angle between A and B if ß = 6.
Q: Annual additions to qualified retirement plans include interest and dividend income. forfeitures…
Q: The log of the field metabolic rate (FMR) or the log of the total energy expenditure per day in…
Q: = A small block slides without friction up and over the icy hill shown in the figure below. The…
Q: A 5.0 mH inductor and a 10.0 resistor are connected in series with a 6.0 V ideal battery and a…
Q: A particle starts from the origin of a three-dimensional coordinate system and undergoes two…
Q: 37. Which of the following statements best describes the condition of our inland waters today as…
Q: mandatory competency test for high school sophomores has a normal distribution with a mean of  425…
Q: What chemical equation best describes the oxidation of a metal with hydrochloric acid? M(s) + x…