Calling option from menu function
2 ビュー (過去 30 日間)
古いコメントを表示
The code has main menu based on ATM macine. 1-Get cash. 2-Get Balance. 3-Quit % if user choose option 1
Mainmenu= menu('Main Menu','1-Get Cash','2-Get Balance','3-Quit');
if Mainmenu ==1
In Get Cash, Another menu that the user have to choose how much to withdraw
GetCashM= menu('Withdrawal amount','20$','40$','100$','200$');
, and after that, another menu to prompt the user to select 1- checking, 2- savings,
Acct= menu('From which account','checking','Saving');
and disp how many 20 bills were dispansed that is after verifying if there are enough funds in the selected account. And when option 1 or 2 are processed, the main menu will show again. I got that done. But, If option 3- quit selected, display New checking Balance and New Saving Balance. But how can I subtract the withdraw amount from checking savings account since menu option are string I think. Even if I called it it would be 1 or 2 or 3 or 4 respectivly to withdraw amount menu.
(ex)
Sbal = 100;
if the user withdrew 20$ from Sbal . "in option 1 from whidraw amount "
"second iteration."
if MainMenu ==. 3 % if the user choose option quit after proseccing whidraw amount
NewSavBal = GetCashMenu - SBal;
but that did not do it since values inside menu were string.
Keep in mind that
- If the user closes the menu rather than making a selection, warning message should bedisplayed and the user given 2 more chances to make a selection from that menu. If they still close the menu on the 3rd attempt, an error message should be displayed that says the program has been terminated.
7 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!