From c67224ac22ab54854b7d2fae25cb1d571443f639 Mon Sep 17 00:00:00 2001 From: Zihao Castine Date: Tue, 3 May 2016 14:51:00 -0400 Subject: [PATCH 1/4] first commit --- .idea/compiler.xml | 32 + .idea/copyright/profiles_settings.xml | 3 + .idea/libraries/Maven__junit_junit_4_12.xml | 13 + .../Maven__org_hamcrest_hamcrest_core_1_3.xml | 13 + .idea/misc.xml | 76 ++ .idea/modules.xml | 8 + .idea/workspace.xml | 853 ++++++++++++++++++ BankAccount.iml | 17 + README.md | 1 + pom.xml | 18 + src/main/java/io/zihaocastine/Account.java | 119 +++ .../java/io/zihaocastine/AccountTest.java | 53 ++ .../io/zihaocastine/Account$AccountType.class | Bin 0 -> 1148 bytes .../io/zihaocastine/Account$Status.class | Bin 0 -> 1109 bytes target/classes/io/zihaocastine/Account.class | Bin 0 -> 3426 bytes .../io/zihaocastine/AccountTest.class | Bin 0 -> 2062 bytes 16 files changed, 1206 insertions(+) create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/libraries/Maven__junit_junit_4_12.xml create mode 100644 .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/workspace.xml create mode 100644 BankAccount.iml create mode 100644 README.md create mode 100644 pom.xml create mode 100644 src/main/java/io/zihaocastine/Account.java create mode 100644 src/test/java/io/zihaocastine/AccountTest.java create mode 100644 target/classes/io/zihaocastine/Account$AccountType.class create mode 100644 target/classes/io/zihaocastine/Account$Status.class create mode 100644 target/classes/io/zihaocastine/Account.class create mode 100644 target/test-classes/io/zihaocastine/AccountTest.class diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..5c6f35f --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__junit_junit_4_12.xml b/.idea/libraries/Maven__junit_junit_4_12.xml new file mode 100644 index 0000000..d411041 --- /dev/null +++ b/.idea/libraries/Maven__junit_junit_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..f58bbc1 --- /dev/null +++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ddb5070 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.8 + + + + + + + + 1.8 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b1643fd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..9e649f0 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,853 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1462242216526 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BankAccount.iml b/BankAccount.iml new file mode 100644 index 0000000..03320bd --- /dev/null +++ b/BankAccount.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a12852b --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# BankAccountLab diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..37b8e41 --- /dev/null +++ b/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + castine.zihao + bankAccount + 1.0-SNAPSHOT + + + junit + junit + 4.12 + + + + \ No newline at end of file diff --git a/src/main/java/io/zihaocastine/Account.java b/src/main/java/io/zihaocastine/Account.java new file mode 100644 index 0000000..4be073a --- /dev/null +++ b/src/main/java/io/zihaocastine/Account.java @@ -0,0 +1,119 @@ +package io.zihaocastine; + +import java.util.ArrayList; + +/** + * Created by zihaocastine on 5/2/16. + */ +public class Account { + private AccountType accountType; + private int accountNumber; + private String accountName; + private double balance; + private double interestRate; + private Status status; + private boolean overDraft; + private ArrayList record; + + public enum AccountType{CHECKING, SAVING, INVESTMENT} + public enum Status{OPEN, CLOSED, OFACFREEZE} + + Account(AccountType accountType,int accountNumber, String accountName){ + this.accountType=accountType; + this.accountNumber=accountNumber; + this.accountName=accountName; + balance=0; + interestRate=0; + status=Status.OPEN; + overDraft=false; + record=new ArrayList(); + } + Account(AccountType accountType,int accountNumber,String accountName,double balance){ + this.accountType=accountType; + this.accountNumber=accountNumber; + this.accountName=accountName; + this.balance=balance; + interestRate=0; + status=Status.OPEN; + overDraft=false; + record=new ArrayList(); + } + Account(AccountType accountType,int accountNumber,String accountName,double balance,double interestRate){ + this.accountType=accountType; + this.accountNumber=accountNumber; + this.accountName=accountName; + this.balance=balance; + this.interestRate=interestRate; + status=Status.OPEN; + overDraft=false; + record=new ArrayList(); + } + public double getBalance() { + if(!status.equals(Status.OFACFREEZE)){ + return balance; + } + return -9999; + } + + private void setBalance(double balance) { + + this.balance = balance; + } + public boolean debit(double amount){ + if(status.equals(Status.OPEN)){ + setBalance(balance-amount); + record.add("debit "+amount); + return true; + }else { + return false; + } + } + public boolean credit(double amount){ + if(status.equals(Status.OPEN)){ + setBalance(balance+amount); + record.add("credit "+amount); + return true; + }else { + return false; + } + } + public AccountType getAccountType() { + return accountType; + } + + public int getAccountNumber() { + return accountNumber; + } + + + public String getAccountName() { + return accountName; + } + + public void changeAccountName(String accountName) { + if(!status.equals(Status.CLOSED)) { + this.accountName = accountName; + record.add("changeAccountName "+accountName); + } + } + public void setInterestRate(double interestRate) { + this.interestRate = interestRate; + } + + + public void changeStatus(Status status) { + if(!status.equals(Status.CLOSED)) { + this.status = status; + record.add("changeStatus"+status); + } + } + + public void changeOverDraft(boolean overDraft) { + this.overDraft = overDraft; + record.add("changeOverDraft "+overDraft); + } + + + + +} diff --git a/src/test/java/io/zihaocastine/AccountTest.java b/src/test/java/io/zihaocastine/AccountTest.java new file mode 100644 index 0000000..909faab --- /dev/null +++ b/src/test/java/io/zihaocastine/AccountTest.java @@ -0,0 +1,53 @@ +package io.zihaocastine; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by zihaocastine on 5/3/16. + */ +public class AccountTest { + @Test + public void TestAccount() { + Account account = new Account(Account.AccountType.CHECKING, 12345, "Zihao"); + String expectedName = "Zihao"; + Assert.assertEquals(expectedName, account.getAccountName()); + Account.AccountType expectedType = Account.AccountType.CHECKING; + Assert.assertEquals(expectedType, account.getAccountType()); + int expectedNumber = 12345; + Assert.assertEquals(expectedNumber, account.getAccountNumber()); + + } + @Test + public void TestBalance() { + Account account = new Account(Account.AccountType.CHECKING, 12345, "Zihao",500); + String expectedName="Zihao"; + Assert.assertEquals(expectedName,account.getAccountName()); + Account.AccountType expectedType = Account.AccountType.CHECKING; + Assert.assertEquals(expectedType,account.getAccountType()); + int expectedNumber=12345; + Assert.assertEquals(expectedNumber,account.getAccountNumber()); + double expectedBalance=500; + Assert.assertEquals(expectedBalance,500,0); + } + @Test + public void TestDebit() { + Account account = new Account(Account.AccountType.CHECKING, 12345, "Zihao",500); + double expectedBalance=500; + Assert.assertEquals(expectedBalance,500,0); + account.debit(50); + double expectedAfterChecking=450; + Assert.assertEquals(expectedAfterChecking,account.getBalance(),0); + } + @Test + public void TestCredit() { + Account account = new Account(Account.AccountType.CHECKING, 12345, "Zihao",500); + double expectedBalance=500; + Assert.assertEquals(expectedBalance,500,0); + account.credit(50); + double expectedAfterCredit=550; + Assert.assertEquals(expectedAfterCredit,account.getBalance(),0); + } + + +} diff --git a/target/classes/io/zihaocastine/Account$AccountType.class b/target/classes/io/zihaocastine/Account$AccountType.class new file mode 100644 index 0000000000000000000000000000000000000000..4456a807069512f482cb5d679a47da774bba84e3 GIT binary patch literal 1148 zcma)5?{Csj6g>|LEnPQehs^!(=h%czSJBOBAPa<`5|MoD_X%ebpz4%>V&6eLwD z8XR#?!2*wY1t}iy%Xq+`RGw8U&ufjR3^Qfh?hXB*`R=X5pw)ce=~p~!FmMJ8>vgwh zymybRo^1^R*LRE%of$h-V2GRLmS9tBjaJoczNj{u405JbuD`6B3>&YeB|5RZAy>|3 zbJL!YD!tcaJy|DzjbZoD={K!Ik9K51cJPMbakhSJomhrv`5nUy`mWz8S6pCSDZ)mpB_AO%M*^_Vc-j&B9SJ~2hJyr2|qFFd?A zMqTxX-QrYs_vtcJvp4M9&J&lB9cR3ewp{o5lCPWSHQ4D*)59vQ%7K*5IINm17!@$w8lkEC;SRl zL;MaRVpr9r&CiIPL*n?z1pX@RXunaohU=nELn9Pd%p*!aK;GP1JwyDXD38ls9GA%+ zS;v~dWT0Rjnb1g^8sT60E2OqAN6(;~A|Vo063L86w3tX{1(-?WS zYZYpyIq+RCbDmJ9)Oxd}YtI8`S zC!DZ~uF)rQ^-o6XzGAz!x5tqBOTqnIn+PzbdLrv>jQsiS`C|bu1wx#n|H0?I$wm8f)aKmJZ4z?|1&CB!4n1R*iaCMsvyCS zBvgili!pL#3}Mq5xKuHj%}uFpb&o95BUMZPsKl^4J)vO3%2Nct-)Od8xmu)MU7$r5 zt7)zcAWQNBOA3L-W!^4FAciH}07II*+hqACkHJ16bOzxAc?`>RMuJ#^@GDrI;7bSv zx3VhcKO=kwk>f)%_?vX2oTIRYTS1(LMkrpf2!Vb;%5SZnBJwc^PnWw$mq;E-$7X=Z zAc{N4OoVi(5&qS_LhPuLaEj;&Vu2%zfio94N;q)lBi{%ojA_F<;uv#!Cp^Zyegeh? a%=Rlx3f{#%iiMEHHL^0HMBK+>HT?@uL-14p literal 0 HcmV?d00001 diff --git a/target/classes/io/zihaocastine/Account.class b/target/classes/io/zihaocastine/Account.class new file mode 100644 index 0000000000000000000000000000000000000000..29e84409b0cbcb9fe79d41881ccb3702100d4fe4 GIT binary patch literal 3426 zcmbVOYf}?v6n-{@B*YaI1wm1RpoEP;ZI#f1$i31cD0rpyvLq`kh6Fc>t@dWy5B&}8 zw|;lV))APgGo8-#TYpri&v|zV3nXftOy2uB=Q-y*=Oq99`^TRE&fv!=T5+=mG2D`2 zUWU(P_*{nDH8_Dgvbrn7y)euuqVD?zxl2Vkq(guG{nJyb<5dh+826*7$IS>9WnPlO zmSI_BA4HH5$(0DQ5zNYYE`n8=ABN$Ckq@JwAv9Mo3&p$!eKMQ1oY9P#&s)4IYS=TJ zO67{#!qvyC7I&t9cXGq$))R~9TsgEqOPY1&+& z-ukI!^O4z;F|&(3a|OrFE>bMKVDccvYi*3s>}tY8a!y)9gKM@}urocwj$=NavhxKIn6nqNjEF-+o#oyP?8ZAtxzK=} zwF`q9`r{Q*`9m|gTTSP64Z+b|nwIOP7*aQ8SIvbCPwJ-_>CAQ0v1RWa1`A6zQ`cO{ zB5@78Gn_HObN=1Mm3(y3DvWIAvMS!mY)13GqhMS;t4>=BHd7>9$&$Gu#N#66SZTSa zr5<1SG<3u}D|x+xg8Q~aH(5v^-}qjVm;>Mc!b1UM`|@xuTP@CT!t^?m_An&^r3?NJj_aIyzzKNZ_=N zE_CbYk>LxR(ea)P@8bgv2b81R>96A~&guA49zDhr9iw2r4($xdNYT!urIEMYfwynTu@k;^k5sSNDL{$naktTjP=aK@aV+s`1t%deYGAI%?yieTjpK!{Vr!$SFJ2NOIJB+ z>|%=-L{?}EIscmLNFnF8MGaMEn)*YdQ!{hpOw2Yzn@C=xsf84(c+Fp@7{5RS0U;4r z0pXFFNhLLtO=>2g)J!_5nT%31=>rYDYMn$a=RSPMlaILi6;%jwK4)w|GZJeE7%gk4 zGP>3fG-}sSEknq7f$$n4M%5Z>j8}->+Q6PQ=)WtK{TvPcv;hrN)rcA#qLC&XKr_d~ zIEo`^M+;#eC6kX~K)qK+aUO%*(Y$g_Q!8;VpjP5w6<2+@;K6;yeTXN$<={32|0mw# z#2X{tR^mNDylq6>PJ}172;N?)ZH2d23S5P?4?`aE z4c?jiIK^3rM33{>wJz0XD zEJ06}peLn4QC7n+Mm#4jGBJ{*M&l(SFR*tVwZD)SFH!ycAnKm;CIF#BtqQ|g>}3G! zkyJQzSJJ}~kS^wF9pr0CbI9mm0=GyNRWul2=+7$+jcOk%c@k1s`40l)nDBHx;cL;= z>mm#j;m&I+|_-pH)38dC;g5et{kgkDG6T!UfjxO9Xx^ zxhH7_uJ{roL6%z7Xke<0urD^Q@U^nSmoQyMIJndDd|BZcT=s;sOrq3Ox0}YpifC=p zpMw4j9%1AX{CXMOqE5Z4zB>%tT@vsfiL&4eS$By--HP~mU`{2y-MricIl literal 0 HcmV?d00001 diff --git a/target/test-classes/io/zihaocastine/AccountTest.class b/target/test-classes/io/zihaocastine/AccountTest.class new file mode 100644 index 0000000000000000000000000000000000000000..eecf1d3c7202652eb0e9c0db42be30fef8d9c387 GIT binary patch literal 2062 zcmbVNYf~F#6n@^YNg!-P2;ma3ShakADU8`!b0BPGUJBDMGZ6=Q7%aud@xW+>2?UHXBGY-DU&L{^|j z`ex02%MloCc%;8{NcqStenpJ}A?cH;mmK|E^#N40Y=UhJ5w|&{MC6zTiteD{LyYkCB>(&na;mt# z&zsI&NNe&G;#VGgxXd-+8hbFtvs!n+2e`tUV5(7i$>3j@%+LMi@9;f-g|7aE<*0HB ze?F?*pPhM)z!`!x7v^~G=9$lLD1*vNUVC1iA=JVfM>q4Rh~N?i5GFz&@gjVa_G1=N zEFtD{xn9TfxI~~~924X;fGJG!-^V9$TtyOHj8iegRlyu{OGWeC1tmB5|A``g&qZlxwDXp*v~Nc1WRO|!ll$tGM8N!FTBO%aoxh+&G9G=22$rJ%)g zJ-Pmlga=7@=)VZhlJFb}&y$o+x(lSRNW$0t2jP#;5%w{I{HiQbxcmj@%Yip775@j! C@1)HD literal 0 HcmV?d00001 From 402f3d788fb7cd75ab16ff5e84deb84927f49258 Mon Sep 17 00:00:00 2001 From: Zihao Castine Date: Mon, 16 May 2016 13:57:59 -0400 Subject: [PATCH 2/4] finish bankAccount --- .DS_Store | Bin 0 -> 6148 bytes .idea/compiler.xml | 2 +- .idea/misc.xml | 50 -- .idea/vcs.xml | 6 + .idea/workspace.xml | 670 ++++++++++++++---- BankAccount.iml | 2 +- src/.DS_Store | Bin 0 -> 6148 bytes src/main/java/io/zihaocastine/ATMDriver.java | 224 ++++++ src/main/java/io/zihaocastine/Account.java | 35 +- .../java/io/zihaocastine/Transaction.java | 67 ++ src/main/java/io/zihaocastine/User.java | 42 ++ .../java/io/zihaocastine/TransactionTest.java | 40 ++ target/.DS_Store | Bin 0 -> 6148 bytes .../classes/io/zihaocastine/ATMDriver.class | Bin 0 -> 8236 bytes .../io/zihaocastine/Account$AccountType.class | Bin 1148 -> 1148 bytes .../io/zihaocastine/Account$Status.class | Bin 1109 -> 1109 bytes target/classes/io/zihaocastine/Account.class | Bin 3426 -> 3876 bytes .../io/zihaocastine/Transaction$1.class | Bin 0 -> 841 bytes .../Transaction$TransactionType.class | Bin 0 -> 1216 bytes .../classes/io/zihaocastine/Transaction.class | Bin 0 -> 2373 bytes target/classes/io/zihaocastine/User.class | Bin 0 -> 1368 bytes .../io/zihaocastine/AccountTest.class | Bin 2062 -> 2062 bytes .../io/zihaocastine/TransactionTest.class | Bin 0 -> 1978 bytes 23 files changed, 961 insertions(+), 177 deletions(-) create mode 100644 .DS_Store create mode 100644 .idea/vcs.xml create mode 100644 src/.DS_Store create mode 100644 src/main/java/io/zihaocastine/ATMDriver.java create mode 100644 src/main/java/io/zihaocastine/Transaction.java create mode 100644 src/main/java/io/zihaocastine/User.java create mode 100644 src/test/java/io/zihaocastine/TransactionTest.java create mode 100644 target/.DS_Store create mode 100644 target/classes/io/zihaocastine/ATMDriver.class create mode 100644 target/classes/io/zihaocastine/Transaction$1.class create mode 100644 target/classes/io/zihaocastine/Transaction$TransactionType.class create mode 100644 target/classes/io/zihaocastine/Transaction.class create mode 100644 target/classes/io/zihaocastine/User.class create mode 100644 target/test-classes/io/zihaocastine/TransactionTest.class diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..54ac10d9e515ff385a064b723cc07529f8586fe0 GIT binary patch literal 6148 zcmeHK-D(p-6h4#0cDHG8FDevN*vo>Uq&Aq_7!yHJ3{6Qdti;{!(hS}1hTTbG34vVs z0D9v)_y9hD;t%)$;#YT)3EJ%QQz%U~NQoI-Ff zh>qMKa*@fGiM!}q=$YvhOMq4A;fy~;_OlDvpOLXO6(-mw>_G$jsl!9WZH(~J`Nap&=A2tGi;D?Xm2M+V&$DF($MFA3I-ErI0A9k#bJ5k6S z8v3!wCvzMg(9ny9wWuF@$>D6`j&-FO`vVMZI-%dD33X{e*_lYHh@#$fSQk4ptQV$X zcC5|OXt!K0+B-KZD%`oLTVtm zC=1(Acn&|Yq68bX;xLH9V{GB<6=3)(#BdBgu(af2;9t!QWs0kX|5M>pvdzhVK0wPs z^?Dfj<#eZe(F$k<{vieU`e37TtSX#H6iWvd;s}74!)9Sv=N}0?##UHWIFX2V(1;90 zl%Yf&F^CMuc3bhP3MUd}I1qLCAgX7gPAEk5j`?jt2U3-&ORa!bAgw@FURr$rZ~XrJ zpAOPjS^=%Vf29D))m!x%K9bs77aor9wKn=wbZ(qCktjm2P}{Mn@U3_gT^Qc8c?Gem Ua3T>~(Da9ZkU - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ddb5070..233a7f0 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -23,54 +23,4 @@ - - - - - - - - - - - - 1.8 - - - - - - - - 1.8 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9e649f0..e2295a9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,21 @@ - + + + + + + + + + + + + + + + @@ -18,43 +32,44 @@ + + - - + + - - + + - - + + - - - - - - - - - + + + - - + + - - + + @@ -62,6 +77,16 @@ + + + + + + + + + + @@ -71,6 +96,9 @@ + + - - + + true + DEFINITION_ORDER - - + @@ -133,26 +166,27 @@ - - - + + + - + - - + + + - - + + - + - + - + - + - + + - @@ -684,19 +712,19 @@ - - - - - + + + + + - - - - - + + + + + @@ -711,73 +739,81 @@ - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + - - - + + - + - + - - - - + + + + - + - + @@ -786,7 +822,15 @@ - @@ -795,24 +839,248 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + @@ -825,29 +1093,193 @@ + + + + + + + + + + + + + + + + - - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + No facets are configured + + + + + + + + + + + + + + + 1.8 + + + + + + + + BankAccount + + + + + + + + 1.8 + + + + + + + + Maven: junit:junit:4.12 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BankAccount.iml b/BankAccount.iml index 03320bd..5cf6df2 100644 --- a/BankAccount.iml +++ b/BankAccount.iml @@ -1,6 +1,6 @@ - + diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f82fe7d786559c4faca97dad18564278e4701480 GIT binary patch literal 6148 zcmeHKyH3ME5S#@Uk!Vs9@lRp)0U|cE6lhl39pCNF zS)Rgs3&0lphf81%U`BVun}?}+-hE;xwc}`h#%i;@UvIW+uH(Q7W4hto4$rv56JAFA zYvwKvVL|M$!y{g?8`Zs!>Y`Xd3P=GdAO)m=6!=jA_H4J=S)!s8kOETRO9B5s^mNBo zI3&iegTb%wp6?vp_#9V%Vqfc4I3zMdv!oJ}YBge5O%9fH=3CVdiAjgWn|V&X*=j*$U91?@h{h$+d5pZ2(Qs6HX_yB=MB{l#6 literal 0 HcmV?d00001 diff --git a/src/main/java/io/zihaocastine/ATMDriver.java b/src/main/java/io/zihaocastine/ATMDriver.java new file mode 100644 index 0000000..55e8c5b --- /dev/null +++ b/src/main/java/io/zihaocastine/ATMDriver.java @@ -0,0 +1,224 @@ +package io.zihaocastine; + +import java.util.ArrayList; +import java.util.Scanner; + +/** + * Created by zihaocastine on 5/9/16. + */ +public class ATMDriver { + int userNum; + int accountNum; + + public static void main(String[] args) { + ATMDriver atmDriver=new ATMDriver(); + atmDriver.start(); + } + public void start(){ + //ArrayList accountList=new ArrayList(); + ArrayList users=new ArrayList(); + Scanner input=new Scanner(System.in); + int choice=-5; + userNum =0; + accountNum =0; + userPrintOption(); + System.out.print("Enter: "); + choice = input.nextByte(); + while(choice!=0) { + + switch (choice){ + case 1:users.add(createUser()); + break; + case 2:choiceUser(users); + break; + default: + break; + + } + while (choice != -1 && !users.isEmpty()) { + accountPrintOption(); + System.out.print("Enter: "); + choice = input.nextByte(); + switch (choice) { + case 1: + users.get(userNum).getAccountList().add(createAccount()); + break; + case 2: + choiceAccount(users.get(userNum)); + break; + case 3: + System.out.println("Account # " + users.get(userNum).getAccountList().get(accountNum).getAccountNumber() + " balance is " + users.get(userNum).getAccountList().get(accountNum).getBalance()); + break; + case 4: + withdrawAccount(users.get(userNum).getAccountList().get(accountNum)); + break; + case 5: + depositAccount(users.get(userNum).getAccountList().get(accountNum)); + break; + case 6: + transferAccount(users.get(userNum).getAccountList().get(accountNum), users.get(userNum).getAccountList().get(accountNum)); + break; + case 7: + if (closeAccount(users.get(userNum).getAccountList().get(accountNum))) { + System.out.println("Account # " + users.get(userNum).getAccountList().get(accountNum).getAccountNumber() + " is now closed"); + } else { + System.out.println("Account # " + users.get(userNum).getAccountList().get(accountNum).getAccountNumber() + " is unable to close due to remaining balance " + users.get(userNum).getAccountList().get(accountNum).getBalance()); + } + break; + case 8: + printAccountHistory(users.get(userNum).getAccountList().get(accountNum)); + default: + break; + + } + } + userNum++; + userPrintOption(); + System.out.print("Enter: "); + choice = input.nextByte(); + } + + } + private void userPrintOption(){ + System.out.println("Enter 0 to exit"); + System.out.println( "1) New user"); + System.out.println( "2) Existing user"); + } + + private void accountPrintOption(){ + System.out.println("Enter -1 to exit"); + System.out.println( "1) Open new account"); + System.out.println( "2) Existing account"); + System.out.println( "3) Check balance"); + System.out.println( "4) Withdraw from account"); + System.out.println( "5) Deposit to account"); + System.out.println( "6) Transfer across accounts (self)"); + System.out.println( "7) Close account (must be empty)"); + System.out.println( "8) Print transaction history"); + + } + + private Account createAccount(){ + Account account; + Scanner input=new Scanner(System.in); + System.out.println("Enter the type of account (c for checking, s for saving, i for investment"); + String type=input.next(); + System.out.println("Enter an account number"); + int number=input.nextInt(); + System.out.println("Enter the name of the account"); + String name=input.nextLine(); + input.nextLine(); + System.out.println("Enter the balance of the account"); + int balance=input.nextInt(); + switch (type.toLowerCase()){ + case "c": account =new Account(Account.AccountType.CHECKING, number,name,balance); + break; + case "s": account =new Account(Account.AccountType.SAVING, number,name,balance); + break; + case "i": account =new Account(Account.AccountType.INVESTMENT, number,name,balance); + break; + default: account =new Account(Account.AccountType.CHECKING, number,name,balance); + break; + } + + return account; + } + + private User createUser(){ + User user; + Scanner input=new Scanner(System.in); + System.out.println("Enter username: "); + String username=input.nextLine(); + System.out.println("Enter password: "); + String password=input.next(); + user=new User(username,password); + + return user; + } + private void withdrawAccount(Account account){ + double amount=0; + Scanner input= new Scanner(System.in); + System.out.print("Enter the amount you want to withdrawal: "); + amount=input.nextDouble(); + Transaction transaction=new Transaction(Transaction.TransactionType.WITHDRAWALS,amount,account,null); + transaction.makeTransaction(); + } + + private void depositAccount(Account account){ + double amount=0; + Scanner input= new Scanner(System.in); + System.out.print("Enter the amount you want to deposit: "); + amount=input.nextDouble(); + Transaction transaction=new Transaction(Transaction.TransactionType.DEPOSITS,amount,account,null); + transaction.makeTransaction(); + } + + private void transferAccount(Account account1, Account account2){ + double amount=0; + Scanner input= new Scanner(System.in); + System.out.print("Enter the amount you want to transfer: "); + amount=input.nextDouble(); + Transaction transaction=new Transaction(Transaction.TransactionType.TRANSFERS,amount,account1,account2); + transaction.makeTransaction(); + } + + private boolean closeAccount(Account account){ + if(account.getBalance()==0){ + account.changeStatus(Account.Status.CLOSED); + return true; + }else { + return false; + } + } + + private void printAccountHistory(Account account){ + System.out.println(account.getRecord().toString()); + + } + + private void choiceUser(ArrayList users){ + // users.equals(createUser()); + + User tempUser=createUser(); + for (User each: users ) { + if( each.getUsername().equals(tempUser.getUsername())&& each.getPassword().equals(tempUser.getPassword())){ + userNum =users.indexOf(each); + } + } + } + + private void choiceAccount(User user){ + Account tempAccount=createTempAccount(); + for (Account each: user.getAccountList() ) { + if( each.getAccountType().equals(tempAccount.getAccountType())&& each.getAccountNumber() ==tempAccount.getAccountNumber()){ + accountNum =user.getAccountList().indexOf(each); + } + } + + } + + private Account createTempAccount(){ + Account tempAccount; + Scanner input=new Scanner(System.in); + System.out.println("Enter the type of account (c for checking, s for saving, i for investment"); + String type=input.next(); + System.out.println("Enter an account number"); + int number=input.nextInt(); + System.out.println("Enter the name of the account"); + String name=input.nextLine(); + input.nextLine(); + switch (type.toLowerCase()){ + case "c": tempAccount =new Account(Account.AccountType.CHECKING, number,name); + break; + case "s": tempAccount =new Account(Account.AccountType.SAVING, number,name); + break; + case "i": tempAccount =new Account(Account.AccountType.INVESTMENT, number,name); + break; + default: tempAccount =new Account(Account.AccountType.CHECKING, number,name); + break; + } + + return tempAccount; + } + +} diff --git a/src/main/java/io/zihaocastine/Account.java b/src/main/java/io/zihaocastine/Account.java index 4be073a..0070c2b 100644 --- a/src/main/java/io/zihaocastine/Account.java +++ b/src/main/java/io/zihaocastine/Account.java @@ -28,6 +28,7 @@ public enum Status{OPEN, CLOSED, OFACFREEZE} overDraft=false; record=new ArrayList(); } + Account(AccountType accountType,int accountNumber,String accountName,double balance){ this.accountType=accountType; this.accountNumber=accountNumber; @@ -38,6 +39,7 @@ public enum Status{OPEN, CLOSED, OFACFREEZE} overDraft=false; record=new ArrayList(); } + Account(AccountType accountType,int accountNumber,String accountName,double balance,double interestRate){ this.accountType=accountType; this.accountNumber=accountNumber; @@ -48,6 +50,7 @@ public enum Status{OPEN, CLOSED, OFACFREEZE} overDraft=false; record=new ArrayList(); } + public double getBalance() { if(!status.equals(Status.OFACFREEZE)){ return balance; @@ -59,17 +62,23 @@ private void setBalance(double balance) { this.balance = balance; } + public boolean debit(double amount){ - if(status.equals(Status.OPEN)){ - setBalance(balance-amount); - record.add("debit "+amount); - return true; + if(isAccountOpen()){ + if((balance-amount)>=0) { + setBalance(balance - amount); + record.add("debit " + amount); + return true; + }else { + return false; + } }else { return false; } } + public boolean credit(double amount){ - if(status.equals(Status.OPEN)){ + if(isAccountOpen()){ setBalance(balance+amount); record.add("credit "+amount); return true; @@ -77,6 +86,15 @@ public boolean credit(double amount){ return false; } } + + public boolean isAccountOpen(){ + if(status.equals(Status.OPEN)){ + return true; + }else { + return false; + } + + } public AccountType getAccountType() { return accountType; } @@ -113,7 +131,12 @@ public void changeOverDraft(boolean overDraft) { record.add("changeOverDraft "+overDraft); } + public void setRecord(String steatment) { + record.add(steatment); + } - + public ArrayList getRecord() { + return record; + } } diff --git a/src/main/java/io/zihaocastine/Transaction.java b/src/main/java/io/zihaocastine/Transaction.java new file mode 100644 index 0000000..f3d80c1 --- /dev/null +++ b/src/main/java/io/zihaocastine/Transaction.java @@ -0,0 +1,67 @@ +package io.zihaocastine; + + +import java.util.Date; + +/** + * Created by zihaocastine on 5/3/16. + */ +public class Transaction { + private TransactionType transactionType; + private double amount; + private Account sourceAccount; + private Account destinationAccount; + private Date timeStamp; + private String FTN; + public enum TransactionType{ + WITHDRAWALS, DEPOSITS, TRANSFERS + } + + Transaction(TransactionType transactionType, double amount, Account sourceAccount, Account destinationAccount){ + this.transactionType=transactionType; + this.amount=amount; + this.sourceAccount=sourceAccount; + this.destinationAccount=destinationAccount; + //timeStamp=new Date(); + } + + public void makeTransaction(){ + switch (transactionType){ + case WITHDRAWALS: + if (sourceAccount.debit(amount)){ + timeStamp=new Date(); + sourceAccount.setRecord("Withdrawal " +amount+" time: "+timeStamp); + }else { + System.out.println("Transaction fail"); + sourceAccount.setRecord("Withdrawal fail, time: "+timeStamp); + } + break; + case DEPOSITS: + sourceAccount.credit(amount); + timeStamp=new Date(); + sourceAccount.setRecord("Deposit " +amount); + break; + case TRANSFERS: + if(destinationAccount.getAccountName()!="null"){ + if (sourceAccount.debit(amount)){ + timeStamp=new Date(); + sourceAccount.setRecord("Withdrawal " +amount+", time: "+timeStamp); + destinationAccount.credit(amount); + sourceAccount.setRecord("Transfer "+amount+" to "+destinationAccount.getAccountName()); + destinationAccount.setRecord(amount+" transfer from "+sourceAccount.getAccountName()); + }else { + System.out.println("Transaction fail"); + sourceAccount.setRecord("Transfer fail, time: "+timeStamp); + } + + } + break; + default:System.out.println("makeTransaction error"); + } + } + + + + + +} diff --git a/src/main/java/io/zihaocastine/User.java b/src/main/java/io/zihaocastine/User.java new file mode 100644 index 0000000..324bbdb --- /dev/null +++ b/src/main/java/io/zihaocastine/User.java @@ -0,0 +1,42 @@ +package io.zihaocastine; + +import java.util.ArrayList; + +/** + * Created by zihaocastine on 5/10/16. + */ +public class User { + private String username; + private String password; + private ArrayList accountList; + + User(String username, String password){ + this.username=username; + this.password=password; + accountList=new ArrayList(); + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public ArrayList getAccountList() { + return accountList; + } + + public void AccountList(ArrayList accountList) { + this.accountList = accountList; + } +} diff --git a/src/test/java/io/zihaocastine/TransactionTest.java b/src/test/java/io/zihaocastine/TransactionTest.java new file mode 100644 index 0000000..b75d51c --- /dev/null +++ b/src/test/java/io/zihaocastine/TransactionTest.java @@ -0,0 +1,40 @@ +package io.zihaocastine; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by zihaocastine on 5/3/16. + */ +public class TransactionTest { + @Test + public void makeTransactionDepositsTest(){ + Account account1 = new Account(Account.AccountType.CHECKING, 12345, "Zihao",500); + Transaction transaction=new Transaction(Transaction.TransactionType.DEPOSITS,200,account1,null); + transaction.makeTransaction(); + + Assert.assertEquals("Value should be 700", 700,account1.getBalance(),0); + + } + @Test + public void makeTransactionWithdrawalTest(){ + Account account1 = new Account(Account.AccountType.CHECKING, 12345, "Zihao",500); + Transaction transaction=new Transaction(Transaction.TransactionType.WITHDRAWALS,200,account1,null); + transaction.makeTransaction(); + + Assert.assertEquals("Value should be 300", 300,account1.getBalance(),0); + + } + @Test + public void makeTransactionTransferTest(){ + Account account1 = new Account(Account.AccountType.CHECKING, 12345, "Zihao",500); + Account account2 = new Account(Account.AccountType.CHECKING, 56789, "Castine",1000); + Transaction transaction=new Transaction(Transaction.TransactionType.TRANSFERS,200,account1,account2); + transaction.makeTransaction(); + Assert.assertEquals("account1 balance should be 300", 300,account1.getBalance(),0); + Assert.assertEquals("account2 balance should be 1200", 1200,account2.getBalance(),0); + + } + +} diff --git a/target/.DS_Store b/target/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..944f6479be63292c9930835429fec3b1defb4e76 GIT binary patch literal 6148 zcmeHK%}N773{JFQK@asJ9_Q%AgKsdDDtOfw&~Bxd#f5Hrp9k~-d>j4pV`0~!M-fd* z=F4P~?92z9A0p!UZgoR6Bcdr(kj1EoxT`})9y|fE*68Vl`unzPmTjfbZ*AXMB<7V5ZHrD i06MadT$+|81kjJrO>+q%6R&2?UElaX3TZdyQc9b}Y$E&rqv9v38 zSC$PupaoJ&poLOWC(Qwr2trz7H>?PzIUuDF5+H$amZoi5($dhTEg>yV?7rX3?4i}s z@-)uOe|`7)@93G!Uw9nA78MNO1kUTY5P*jB^7?Zfj|Px0o1ZH{64L?b_ z1m>a~e9^#P1n@YX5P&CT`zgWulFYs=v!`YDmooc`j=u_EF}^B0Uz67}I=&vjQk*yN ztc=g;_(lLL@J(5K%fR!pctIB5me+TL(TjrkU3q;^Uf-A34-EX!z>j45*9LxU;BO4P zWZ-WN{GEZnH}JB7e=zWm27Y4T6$Afd;Gad@pBnfV8DBN#CZ}CgP!3 z-^7@L>Q)HY!C-VEl5jTsJHnB0qD>*MuKuusuOm7fQdrazj)ZuAJQN$WkB@SvtS1_@ zM-SVvu&ljJUt%O2S6JE;j&6K=c*G`1JVDHj?Ss9YvGD0otd%6k>~KV(s_y2V+wIf# z#!)+Ra^pZE7LJ^3by(W5lO$3;$FV|zofvZ|Ddfi!b}YeBv>`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yLQl zjy2r|UP~FkBrIgEl=E9rHG|QjersrnCQ2{X+2XSC0=9`ldynU7HX_~VIs54reBsj0X-BW#NkzT)gsaGU8JRbd-6k^p{|L&DXr7>-q(#MZO~w1OESfL*e^>;i z@%nip7ClnmxK1qUukp`e(R(TAeYDH{6!ZZK`Y{UnaSHkgN6)>#d0OOgZwE^pGbc%Zn!W$?*n!8e2N!v9{-PtFbmLlP+b5ZK z()sqMCEf4!<$QGEL7r;qZY)rfNOj{y$a@O`9aB0!)%r_N&Ms;c6MATEQfS&%x2s;?jBmB@Ke-X<6uL>AKd{@(F7BByTlOQOhq;!>7^1 zn~Y?IXt~nS^1Y6hy=g6by^531CiFT7(*DhBV^%~j8Mf{CSdh|+m z{NH=2(>?uKvo3k#bk9E0%i|-xb0r_?o$Y+2cQ)1dGrd!n-s#WuPOeM1PWMi|QkUM@ z&qw}C_0C4lughwF(+II~HfJ?XcV~50*K~Kva_;kB;#}ODayQ4Hnw>g%UmR@0{@#i*2 k$BLhI-j68p$r6h62LHUgYgdiZ_{Z!09Oci=hj!Kc4^;fq)Bpeg literal 0 HcmV?d00001 diff --git a/target/classes/io/zihaocastine/Account$AccountType.class b/target/classes/io/zihaocastine/Account$AccountType.class index 4456a807069512f482cb5d679a47da774bba84e3..df867729f263c4c9c32c70a662e17a0c766f5289 100644 GIT binary patch delta 17 Zcmeyv@rQ%s)W2Q(7#J8#Hgc4(002k{2DShI delta 17 Zcmeyv@rQ%s)W2Q(7#J7~H*%D)002k&2D1PF diff --git a/target/classes/io/zihaocastine/Account$Status.class b/target/classes/io/zihaocastine/Account$Status.class index 15d82a607820fead6ad609947dc891c1812fa79e..4e2daabe1d11f0569025e5c22811716a2c7561a6 100644 GIT binary patch delta 17 Zcmcc0ag~GP)W2Q(7#J8#Hgfo~002VU20;J- delta 17 Zcmcc0ag~GP)W2Q(7#J7~H*)y0002VF20j1) diff --git a/target/classes/io/zihaocastine/Account.class b/target/classes/io/zihaocastine/Account.class index 29e84409b0cbcb9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q*`9m|gTTSP64Z+b|nwIOP7*aQ8SIvbCPwJ-_>CAQ0v1RWa1`A6zQ`cO{ zB5@78Gn_HObN=1Mm3(y3DvWIAvMS!mY)13GqhMS;t4>=BHd7>9$&$Gu#N#66SZTSa zr5<1SG<3u}D|x+xg8Q~aH(5v^-}qjVm;>Mc!b1UM`|@xuTP@CT!t^?m_An&^r3?NJj_aIyzzKNZ_=N zE_CbYk>LxR(ea)P@8bgv2b81R>96A~&guA49zDhr9iw2r4($xdNYT!urIEMYfwynTu@k;^k5sSNDL{$naktTjP=aK@aV+s`1t%deYGAI%?yieTjpK!{Vr!$SFJ2NOIJB+ z>|%=-L{?}EIscmLNFnF8MGaMEn)*YdQ!{hpOw2Yzn@C=xsf84(c+Fp@7{5RS0U;4r z0pXFFNhLLtO=>2g)J!_5nT%31=>rYDYMn$a=RSPMlaILi6;%jwK4)w|GZJeE7%gk4 zGP>3fG-}sSEknq7f$$n4M%5Z>j8}->+Q6PQ=)WtK{TvPcv;hrN)rcA#qLC&XKr_d~ zIEo`^M+;#eC6kX~K)qK+aUO%*(Y$g_Q!8;VpjP5w6<2+@;K6;yeTXN$<={32|0mw# z#2X{tR^mNDylq6>PJ}172;N?)ZH2d23S5P?4?`aE z4c?jiIK^3rM33{>wJz0XD zEJ06}peLn4QC7n+Mm#4jGBJ{*M&l(SFR*tVwZD)SFH!ycAnKm;CIF#BtqQ|g>}3G! zkyJQzSJJ}~kS^wF9pr0CbI9mm0=GyNRWul2=+7$+jcOk%c@k1s`40l)nDBHx;cL;= z>mm#j;m&I+|_-pH)38dC;g5et{kgkDG6T!UfjxO9Xx^ zxhH7_uJ{roL6%z7Xke<0urD^Q@U^nSmoQyMIJndDd|BZcT=s;sOrq3Ox0}YpifC=p zpMw4j9%1AX{CXMOqE5Z4zB>%tT@vsfiL&4eS$By--HP~mU`{2y-MricIl diff --git a/target/classes/io/zihaocastine/Transaction$1.class b/target/classes/io/zihaocastine/Transaction$1.class new file mode 100644 index 0000000000000000000000000000000000000000..9502a48e0de7691921ece2270befc5b19ae80df5 GIT binary patch literal 841 zcmb7C+iuf95Ivi?c9Oaz4W*p1zHc=yTsbZ^n=+nlrnk~j#*-jCB z0KdXBAR&ZMKY))y%o;=^Ayum6*_kstb7s6VKYx8c1@H)4Ib204iwu^sWGySWV&Iwr zWp!LPaKpe&h9{Q&R>bbO!;dW?t@mQgrOTsO1fJ!DJczg(3mHt?&bwoeA$8DV$UJv_ z5s3H&L%LGkXVA9gh%WPO%I{9z4873dL!UgwHqrX~JQNE5bm)=lIvYhnWx6II+{SXL=Dp9hDv zuCyoaxG6k;)CfZvn%GofcTr&|3t5}~@7h#V>j8t=3IZ?O_IVU}5jAzj+8Z8uZp^T9 z4gHe@&w0r!*X zs&Vf$_Ih^9A*!s?uXpWcqi+{hY0a{P0p_o@w@A=YxZJ>)&t9N4Y*?+ga5Zrg^lY4PFE z7&0t3%t7&kdB6ufK6FjnDEd6ozP<1+F(_NL7rT1BMX@8TW_3s3t~F^dr`y%W%Np$p zucnL`KH}C$P+7@jr}dRK2XCmRSc8b~jQU-}Y4NT_C$blG_bo#;(>UZuyl8QIzo@&8 zY44Y^Q&LPcs5@4hJEn*}Ng>(1Pni;bhi3?vP1|%g80PW5 zDTYDABA#ftiCY?CNNAW7OA-l&+4GJI-VC9hHL!_7GL!YywA(#2dM?pi{7+hjb$<`N z!7cfM{JGMLIZKsQdJ?nro}@}j@B>H^MNbk-Aif~#7YIaf1y{k4BJDOw@u_35&j_3% z_>nY*1zN+NEl&7FEKTrh2zaMzLdtzX=oFH`2QJ{R(TR43!gbv6?9@0yiHxfV(htbF z{L%@+pFFca-MPC=^oTm{c$hR4+(mjqK&rL_I|ddCE-q zJK=(3n!%1VMpW;F#+cEM!32S`dR1ZwT*7_CiQ!q&d!&i_GIUN|BBX=|h*wg-0SJm3 A?EnA( literal 0 HcmV?d00001 diff --git a/target/classes/io/zihaocastine/Transaction.class b/target/classes/io/zihaocastine/Transaction.class new file mode 100644 index 0000000000000000000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-6#|ogpyxN2_JIN z^gk8KwY9EhcEWi*{Y)TO8z5L+;~8h3!|$7Tk(-mJ^oRMq_Oaffl`$Lb6nHcj+|@50 zk;|j!-lVE&>UOECIgU=X7E3#o(%owP4#Rxkk{OVWmd@6~zYtPHpV`1Cn2PKbTJ(py zd)r?b-dR$nJ$AOmic|@kswwf3*ly+1p4O$xOfC#CuFmtWpa0@ud>_$uj^6TgXLKK4JO%rn9%7iMYr+dA@iIM2z5uUaf!-LdQRkS~ z`D+NEV-q)@Aokz~42>5yvp zVVII!KpJC|IzXSRs(>)R*JtJ-EVufJ>i;%VhAv zv*0cf&IF~NB#;*g?#lmyTYU=mBRLl*V0EB#o|*E5Jefh3yxjG@yv%Wz$;ws?z6^?AsuQZK__AX27ev=yN Date: Mon, 16 May 2016 14:05:55 -0400 Subject: [PATCH 3/4] fix merge conflict --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index ac87b56..2d4fc81 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -<<<<<<< HEAD # BankAccountLab ======= # project-2-ATM @@ -39,4 +38,3 @@ Recommended: Create a `UserInputHandler` class that manages all input requests to the user; Extend this with a `DummyUserInputHandler` for testing (provide scripted user input using this object) ->>>>>>> d61caed1012912feed29ab321d136bbc0b1714db From e14693aed085c90158fdcb3dd82526865ca86e3b Mon Sep 17 00:00:00 2001 From: Zihao Castine Date: Mon, 23 May 2016 11:05:00 -0400 Subject: [PATCH 4/4] polish --- .gitignore | 2 + .idea/workspace.xml | 417 +++++++++++++----- src/main/java/io/zihaocastine/ATMDriver.java | 53 ++- src/main/java/io/zihaocastine/Account.java | 2 +- .../classes/io/zihaocastine/ATMDriver.class | Bin 8236 -> 8646 bytes 5 files changed, 345 insertions(+), 129 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1062418 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +*.iml diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 07efaa0..e77162c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,10 @@ - + + + + @@ -17,6 +20,11 @@ + + + io.zihaocastine.* + + @@ -33,20 +41,10 @@ - - - - - - - - - - - + @@ -56,8 +54,8 @@ - - + + @@ -65,11 +63,31 @@ + + + + + + + + + + - - + + + + + + + + + + + + @@ -98,10 +116,10 @@ @@ -123,11 +141,13 @@ + + + - @@ -154,6 +174,7 @@ + @@ -172,11 +193,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + @@ -191,32 +281,6 @@ - - - - - - - - - - - @@ -315,6 +379,32 @@ + + + + + + + + + + + - - - - - + + + + + - - - - + + + + @@ -752,16 +842,20 @@ - + + + + + - - + + - - + + @@ -789,36 +883,38 @@ - - + - - + - + - + - - + + - + + + + @@ -830,12 +926,12 @@ file://$PROJECT_DIR$/src/main/java/io/zihaocastine/ATMDriver.java - 178 + 205 -