Question: Design an algorithm and a code to simulate a money exchange between the costumer and the vendor. Every time customer gives a money, algortihm should
Design an algorithm and a code to simulate a money exchange between the costumer and the vendor. Every time customer gives a money, algortihm should calculate how much money should be given back as the change. The purchase amount and the customer money should be given at the beginning. The algorithm should give the coin amounts. Example: Purchase is $ customer gives $ then the algorithm should tell the vendor to give back $ to the customer.
After you finish your coding, you should simulate all three possible scenarios and show the outputs one by one:
Customer gives less money than the purchase amount. In this case, give a warning like "The money is not enough".
Customer gives exact money as the purchase amount. In this case, the output will be zero
Customer gives more money than the purchase amount. In this case, the output will be the change amount as in the example above
For this question, identify the inputs and outputs for the code. Identify the mathematical expression for the problem. Finally put all in MATLAB language.
Identify what are the different possible scenarios and how to code those.
You don't have to report your algorithm you will submit only your Matlab code.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
