Question: Write matlab program using function Write a MATLAB function called discountGroceries which takes two integers as inputs and returns one output. The inputs are the
Write a MATLAB function called discountGroceries which takes two integers as inputs and returns one output. The inputs are the initial cost and the % discount. The output is the final cost.The user will have to re-enter if% discountis not a valid number costrina,-(100-% discount) * cost,nit Call the function in the main program and then print the result of the final price also in the main program. Sample output is shown below: (user input is indicated as bold): Please enter the initial cost (in Dhs):1000 Please enter the % discount:110 Invalid input! Please re-enter the % discount: 15 The final price after discount is: 850 Dhs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
