資源簡介
簡單的存款取款查余額程序。適用于matlab初學者
代碼片段和文件信息
%???ATM?program
%
%???Juan?Zizumbo
%
%???ID#?20533709
clear
load?ATMDATA
[nrows?ncolumns]=?size(record);
IDflag=0;
while?IDflag==0
clc
disp(blanks(5)‘);??%?will?display?5?blank?spaces?with?the?syntax?“blanks(n)“?or?5?blank?lines?with?the?syntax?“blanks(n)‘?“?
message=?[blanks(15)?‘Please?Enter?ID#?--->?‘];?????%?prompts?the?user?to?enter?an?ID?number
IDnumber=input(message);????????????????????????%?variable?whose?value?is?the?ID?number
??for?j=1:nrows
????if?IDnumber==record{j2}????%?take?the?contents?of?the?cell?in?the?second?column?j?row?in?order?to?see?if?the?provided?IDnumber?matches
????????IDflag=1;
????????membernumber=j;
????????name=?record{membernumber1};????%?where?the?name?is?this?line?takes?where?the?name?is?from
????????break???%?get?out?of?the?loop?whether?finished?or?not?so?no?more?looping?has?to?occur?when?its?found??
????elseif?IDnumber~=?record{j2}???????????%?If?the?ID?number?DOES?NOT?EQUAL?to?what?is?on?record
????????IDflag=3;
????end
??end
????clc
????disp(blanks(5)‘)
????
????if?IDflag==3????????????????????????????????????????????????%?Will?tell?you?the?ID?is?not?correct?and?ask?for?it?over?and?over
????????message?=[blanks(15)?‘INCORRECT?PIN‘];
????????disp(message)
????????pause(2);
????????IDflag=0;
????end????
????
????if?IDflag==1
???????message=[blanks(15)?‘Hello?‘?name];??????
???????disp(message);
???????pause(2);
???????message2=[blanks(15)?‘My?What?A?Lovely?Day?We?Are?Having?‘?name];
???????disp(message2);
???????message3=[blanks(15)?‘Withdraw?is?1?Deposit?is?2?Check?balance?is?3?--->?‘];???%?asks?the?user?what?type?of?transaction?they?would?like?to?make
???????trans_type=input(message3);??????????????????????????????????????????????????????%?the?transaction?type?here?is?for?Withdrawal
???????if?(trans_type==1)???????????????????????????????????????????????????????????????%?WITHDRAW
???????????disp(‘Withdraw‘)
???????????message6=?[blanks(15)?‘Checking?is?1?Savings?is?2?--->?‘];?????????????????%?asks?if?the?user?would?like?to?withdraw?from?checking?or?savings
???????????inquiry=input(message6);
???????????
???????????if?(inquiry==1)??????????????????????????????????????????????????????????????%?WITHDRAW?from?CHECKING
???????????????pause(1);
???????????????message5=?[blanks(15)?‘How?much?would?you?like?to?withdraw?from?checking??--->?‘];
???????????????amount=input(message5);
???????????????amount=?-amount
???????????????record{j3}(1)=?record{j3}(1)?+?amount
???????????????save?ATMDATA?record;
???????????????IDflag=2;
???????????????
???????????????
???????????elseif?(inquiry==2)??????????????????????????????????????????????????????????%?WITHDRAW?from?SAVING
???????????????pause(1);
???????????????message7=?[blanks(15)?‘How?muc
- 上一篇:PreScan羅技方向聯合控制仿真教程
- 下一篇:matlab人眼識別代碼
評論
共有 條評論