Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Function Name: shopForTheApocalypse MATLAB Inputs 1. (char) The filename of a text file containing your shopping list 2. (char) The filename of an Excel file
Function Name: shopForTheApocalypse MATLAB Inputs 1. (char) The filename of a text file containing your shopping list 2. (char) The filename of an Excel file containing a grocery store inventory Outputs: 1. (char) A string stating the total cost of your grocery store run Background While going through your daily routine of fighting zombies and surviving the apocalypse, you run into the one issue you never anticipated. You're all out of smooth, silky, creamy peanut butter. You decide to go get some groceries from the store, but being the honest person you are, you want to calculate how much the groceries would cost so you could pay the zombie cashier Function Description You are given a grocery list text file with each line in the form: '-
' and an Excel file that contains the inventory for the grocery store you are visiting. The first column in the inventory has the number of items in stock, the second column will have the item name, and the third column has the price per unit (in dollars). Your job is to calculate the total cost of your grocery store run and output the string 'My total will be $.', where total always has 2 decimal places Example inventory.xlsx'- 'list.txt' 11 Milk 1 21 PB 12 PB Milk Eggs out My total will be $28.98.' 13 2.08 4.02 0.72 36 out shopFor TheApocalypse ('list.txt", 'inventory.xlsx') Notes: The shopping list will have only 1 item per line, and each item will be one word Case does not matter You are guaranteed to find everything you need and the store will always have enough You do NOT have to update the store's inventory Hints You can use %0.2f to put a number with 2 decimal points in a string Remember how certain string functions work on cell arrays
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