瀏覽代碼

before my comp dies

shakila 8 年之前
父節點
當前提交
339c0cb136

+ 1
- 2
.idea/compiler.xml 查看文件

@@ -6,10 +6,9 @@
6 6
         <sourceOutputDir name="target/generated-sources/annotations" />
7 7
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8 8
         <outputRelativeToContentRoot value="true" />
9
-        <module name="bankaccountlab" />
10 9
       </profile>
11 10
     </annotationProcessing>
12
-    <bytecodeTargetLevel target="1.8">
11
+    <bytecodeTargetLevel>
13 12
       <module name="bankaccountlab" target="1.5" />
14 13
     </bytecodeTargetLevel>
15 14
   </component>

+ 0
- 122
.idea/misc.xml 查看文件

@@ -1,128 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3
-  <component name="ClientPropertiesManager">
4
-    <properties class="javax.swing.AbstractButton">
5
-      <property name="hideActionText" class="java.lang.Boolean" />
6
-    </properties>
7
-    <properties class="javax.swing.JComponent">
8
-      <property name="html.disable" class="java.lang.Boolean" />
9
-    </properties>
10
-    <properties class="javax.swing.JEditorPane">
11
-      <property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
12
-      <property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
13
-      <property name="charset" class="java.lang.String" />
14
-    </properties>
15
-    <properties class="javax.swing.JList">
16
-      <property name="List.isFileList" class="java.lang.Boolean" />
17
-    </properties>
18
-    <properties class="javax.swing.JPasswordField">
19
-      <property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
20
-    </properties>
21
-    <properties class="javax.swing.JSlider">
22
-      <property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
23
-      <property name="JSlider.isFilled" class="java.lang.Boolean" />
24
-    </properties>
25
-    <properties class="javax.swing.JTable">
26
-      <property name="Table.isFileList" class="java.lang.Boolean" />
27
-      <property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
28
-      <property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
29
-    </properties>
30
-    <properties class="javax.swing.JToolBar">
31
-      <property name="JToolBar.isRollover" class="java.lang.Boolean" />
32
-    </properties>
33
-    <properties class="javax.swing.JTree">
34
-      <property name="JTree.lineStyle" class="java.lang.String" />
35
-    </properties>
36
-    <properties class="javax.swing.text.JTextComponent">
37
-      <property name="caretAspectRatio" class="java.lang.Double" />
38
-      <property name="caretWidth" class="java.lang.Integer" />
39
-    </properties>
40
-  </component>
41
-  <component name="MavenProjectsManager">
42
-    <option name="originalFiles">
43
-      <list>
44
-        <option value="$PROJECT_DIR$/pom.xml" />
45
-      </list>
46
-    </option>
47
-  </component>
48
-  <component name="ProjectInspectionProfilesVisibleTreeState">
49
-    <entry key="Project Default">
50
-      <profile-state>
51
-        <expanded-state>
52
-          <State>
53
-            <id />
54
-          </State>
55
-        </expanded-state>
56
-        <selected-state>
57
-          <State>
58
-            <id>Android</id>
59
-          </State>
60
-        </selected-state>
61
-      </profile-state>
62
-    </entry>
63
-  </component>
64 3
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
65 4
     <output url="file://$PROJECT_DIR$/out" />
66 5
   </component>
67
-  <component name="masterDetails">
68
-    <states>
69
-      <state key="GlobalLibrariesConfigurable.UI">
70
-        <settings>
71
-          <splitter-proportions>
72
-            <option name="proportions">
73
-              <list>
74
-                <option value="0.2" />
75
-              </list>
76
-            </option>
77
-          </splitter-proportions>
78
-        </settings>
79
-      </state>
80
-      <state key="JdkListConfigurable.UI">
81
-        <settings>
82
-          <last-edited>1.8</last-edited>
83
-          <splitter-proportions>
84
-            <option name="proportions">
85
-              <list>
86
-                <option value="0.2" />
87
-              </list>
88
-            </option>
89
-          </splitter-proportions>
90
-        </settings>
91
-      </state>
92
-      <state key="ProjectJDKs.UI">
93
-        <settings>
94
-          <last-edited>1.8</last-edited>
95
-          <splitter-proportions>
96
-            <option name="proportions">
97
-              <list>
98
-                <option value="0.2" />
99
-              </list>
100
-            </option>
101
-          </splitter-proportions>
102
-        </settings>
103
-      </state>
104
-      <state key="ProjectLibrariesConfigurable.UI">
105
-        <settings>
106
-          <splitter-proportions>
107
-            <option name="proportions">
108
-              <list>
109
-                <option value="0.2" />
110
-              </list>
111
-            </option>
112
-          </splitter-proportions>
113
-        </settings>
114
-      </state>
115
-      <state key="ScopeChooserConfigurable.UI">
116
-        <settings>
117
-          <splitter-proportions>
118
-            <option name="proportions">
119
-              <list>
120
-                <option value="0.2" />
121
-              </list>
122
-            </option>
123
-          </splitter-proportions>
124
-        </settings>
125
-      </state>
126
-    </states>
127
-  </component>
128 6
 </project>

+ 2
- 1
.idea/modules.xml 查看文件

@@ -2,7 +2,8 @@
2 2
 <project version="4">
3 3
   <component name="ProjectModuleManager">
4 4
     <modules>
5
-      <module fileurl="file://$PROJECT_DIR$/bankaccountlab.iml" filepath="$PROJECT_DIR$/bankaccountlab.iml" />
5
+      <module fileurl="file://$PROJECT_DIR$/src/main/main.iml" filepath="$PROJECT_DIR$/src/main/main.iml" />
6
+      <module fileurl="file://$PROJECT_DIR$/src/test/test.iml" filepath="$PROJECT_DIR$/src/test/test.iml" />
6 7
     </modules>
7 8
   </component>
8 9
 </project>

+ 543
- 397
.idea/workspace.xml
文件差異過大導致無法顯示
查看文件


二進制
out/production/main/com/zipcodewilmington/bankaccountlab/BankAccount.class 查看文件


二進制
out/production/main/com/zipcodewilmington/bankaccountlab/BusinessAccount.class 查看文件


二進制
out/production/main/com/zipcodewilmington/bankaccountlab/CheckingAccount.class 查看文件


二進制
out/production/main/com/zipcodewilmington/bankaccountlab/MainApplication.class 查看文件


二進制
out/production/main/com/zipcodewilmington/bankaccountlab/SavingsAccount.class 查看文件


二進制
out/test/test/com/zipcodewilmington/bankaccountlab/BankAccountTest.class 查看文件


二進制
out/test/test/com/zipcodewilmington/bankaccountlab/SavingsAccountTest.class 查看文件


二進制
out/test/test/com/zipcodewilmington/bankaccountlab/TestCheckingAccount.class 查看文件


+ 24
- 2
src/main/java/com/zipcodewilmington/bankaccountlab/BankAccount.java 查看文件

@@ -3,5 +3,27 @@ package com.zipcodewilmington.bankaccountlab;
3 3
 /**
4 4
  * Created by leon on 1/10/18.
5 5
  */
6
-public class BankAccount {
7
-}
6
+public abstract class BankAccount {
7
+    private double balance;
8
+    private  double newBalance;
9
+    private int debit;
10
+    private double credit;
11
+
12
+    public BankAccount(){
13
+        balance= 0;
14
+    }
15
+
16
+    public double add(int newBalance){
17
+        this.newBalance = balance + credit;
18
+        return this.newBalance;
19
+    }
20
+
21
+    public double subtract(int newBalance){
22
+        return this.newBalance;
23
+    }
24
+
25
+
26
+    public int getBalance() {
27
+        return (int) balance;
28
+    }
29
+}

+ 5
- 0
src/main/java/com/zipcodewilmington/bankaccountlab/BusinessAccount.java 查看文件

@@ -0,0 +1,5 @@
1
+package com.zipcodewilmington.bankaccountlab;
2
+
3
+public class BusinessAccount {
4
+
5
+}

+ 34
- 0
src/main/java/com/zipcodewilmington/bankaccountlab/CheckingAccount.java 查看文件

@@ -0,0 +1,34 @@
1
+package com.zipcodewilmington.bankaccountlab;
2
+
3
+public class CheckingAccount {
4
+    private int balance = 500;
5
+    private int credit = 200;
6
+    //private int newBalance;
7
+    private int debit = 300;
8
+
9
+    public CheckingAccount(){
10
+        //balance = 500;
11
+        this.credit = credit;
12
+        //this.newBalance = newBalance;
13
+        this.debit = debit;
14
+    }
15
+
16
+    public int deposit(int newBalance) {
17
+        balance = balance + credit;
18
+        return balance;
19
+    }
20
+
21
+
22
+    public int withdrawal(int newBalance) {
23
+        balance = balance - debit;
24
+        return balance;
25
+    }
26
+
27
+    public int getBalance() {
28
+        return balance;
29
+    }
30
+
31
+    public void setBalance(int balance) {
32
+        this.balance = balance;
33
+    }
34
+}

+ 24
- 0
src/main/java/com/zipcodewilmington/bankaccountlab/SavingsAccount.java 查看文件

@@ -0,0 +1,24 @@
1
+package com.zipcodewilmington.bankaccountlab;
2
+
3
+public class SavingsAccount extends BankAccount {
4
+    private int balance = 500;
5
+    private int credit = 200;
6
+    private int debit = 300;
7
+
8
+    public SavingsAccount(){
9
+
10
+    }
11
+
12
+    public int deposit(int balance) {
13
+        return 0;
14
+    }
15
+
16
+    public void setBalance(int balance) {
17
+        this.balance = balance;
18
+    }
19
+
20
+    public int withdrawal(int balance) {
21
+        return 0;
22
+    }
23
+
24
+}

+ 37
- 0
src/test/java/com/zipcodewilmington/bankaccountlab/BankAccountTest.java 查看文件

@@ -1,7 +1,44 @@
1 1
 package com.zipcodewilmington.bankaccountlab;
2
+import org.junit.Assert;
3
+import org.junit.Test;
4
+import static org.junit.Assert.assertEquals;
2 5
 
3 6
 /**
4 7
  * Created by leon on 1/10/18.
5 8
  */
6 9
 public class BankAccountTest {
10
+
11
+    private int balance;
12
+    private int credit;
13
+    private int newBalance;
14
+    private int debit;
15
+
16
+    @Test
17
+    public void addTest(){
18
+        BankAccount bankAccount = null;
19
+       // bankAccount = new BankAccount();
20
+        balance = 500;
21
+        credit = 200;
22
+        int expected = 700;
23
+        double  actual = bankAccount.add(newBalance);
24
+        assertEquals(expected, actual);
25
+    }
26
+
27
+    @Test
28
+    public void subtractTest(){
29
+        BankAccount bankAccount = null;
30
+        balance = 700;
31
+        debit = 300;
32
+        int expected = 400;
33
+        double actual = bankAccount.subtract(newBalance);
34
+        assertEquals(expected, actual);
35
+    }
36
+
37
+    @Test
38
+    public void getBalance(){
39
+        BankAccount bankAccount = null;
40
+        int expected = 400;
41
+        int actual = bankAccount.getBalance();
42
+        assertEquals(expected, actual);
43
+    }
7 44
 }

+ 33
- 0
src/test/java/com/zipcodewilmington/bankaccountlab/SavingsAccountTest.java 查看文件

@@ -0,0 +1,33 @@
1
+package com.zipcodewilmington.bankaccountlab;
2
+import org.junit.Test;
3
+import static org.junit.Assert.*;
4
+
5
+public class SavingsAccountTest {
6
+    private int balance = 500;
7
+    private int credit = 200;
8
+    private int debit = 300;
9
+
10
+    @Test
11
+    public void depositTest(){
12
+        SavingsAccount savingsAccount = new SavingsAccount();
13
+        int expected = 700;
14
+        int actual = savingsAccount.deposit(balance);
15
+        assertEquals(expected, actual);
16
+    }
17
+
18
+    @Test
19
+    public void withdrawalTest(){
20
+        SavingsAccount savingsAccount = new SavingsAccount();
21
+    m    int expected = 200;
22
+        int actual = savingsAccount.withdrawal(balance);
23
+        assertEquals(expected, actual);
24
+    }
25
+
26
+    @Test
27
+    public void getBalanceTest(){
28
+        SavingsAccount savingsAccount = new SavingsAccount();
29
+        int expected = 500;
30
+        int actual = savingsAccount.getBalance(balance);
31
+        assertEquals(expected, actual);
32
+    }
33
+}

+ 39
- 0
src/test/java/com/zipcodewilmington/bankaccountlab/TestCheckingAccount.java 查看文件

@@ -0,0 +1,39 @@
1
+package com.zipcodewilmington.bankaccountlab;
2
+import org.junit.Test;
3
+import static org.junit.Assert.assertEquals;
4
+
5
+public class TestCheckingAccount {
6
+
7
+    private int balance;
8
+    private int credit;
9
+    //private int newBalance;
10
+    private int debit;
11
+
12
+    @Test
13
+    public void depositTest(){
14
+        CheckingAccount checkingAccount = new CheckingAccount();
15
+        //balance = 500;
16
+        //credit = 200;
17
+        int expected = 700;
18
+        int actual = checkingAccount.deposit(balance);
19
+        assertEquals(expected, actual);
20
+    }
21
+
22
+    @Test
23
+    public void withdrawalTest(){
24
+        CheckingAccount checkingAccount = new CheckingAccount();
25
+        //balance = 500;
26
+        //debit = 300;
27
+        int expected = 200;
28
+        int actual = checkingAccount.withdrawal(balance);
29
+        assertEquals(expected, actual);
30
+    }
31
+
32
+    @Test
33
+    public void getBalance(){
34
+        CheckingAccount checkingAccount = new CheckingAccount();
35
+        int expected = 500;
36
+        int actual = checkingAccount.getBalance();
37
+        assertEquals(expected, actual);
38
+    }
39
+}