필터 지우기
필터 지우기

Calling option from menu function

조회 수: 2 (최근 30일)
mat geek
mat geek 2019년 4월 20일
댓글: mat geek 2019년 4월 21일
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
mat geek
mat geek 2019년 4월 21일
ok, I will try to do that. thank you.
mat geek
mat geek 2019년 4월 21일
Thenk you for the help. It is working now just fine.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by