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 matlab program using function  Write matlab program using function Write a MATLAB function called discountGroceries

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!