Kr Younger 6 years ago
parent
commit
f6a9f242cb

+ 55
- 87
.idea/workspace.xml View File

2
 <project version="4">
2
 <project version="4">
3
   <component name="ChangeListManager">
3
   <component name="ChangeListManager">
4
     <list default="true" id="926ad23d-2ddc-41ae-980d-780dcc1811fa" name="Default" comment="">
4
     <list default="true" id="926ad23d-2ddc-41ae-980d-780dcc1811fa" name="Default" comment="">
5
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/pom.xml" />
6
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
7
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
8
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
9
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
10
-      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
5
+      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" />
6
+      <change beforePath="" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java" />
7
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
8
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
9
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
10
+      <change beforePath="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" afterPath="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
11
       <change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
11
       <change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
12
     </list>
12
     </list>
13
     <ignored path="$PROJECT_DIR$/Checkbook/target/" />
13
     <ignored path="$PROJECT_DIR$/Checkbook/target/" />
20
   </component>
20
   </component>
21
   <component name="FileEditorManager">
21
   <component name="FileEditorManager">
22
     <leaf>
22
     <leaf>
23
-      <file leaf-file-name="pom.xml" pinned="false" current-in-tab="false">
24
-        <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
25
-          <provider selected="true" editor-type-id="text-editor">
26
-            <state relative-caret-position="0">
27
-              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
28
-              <folding />
29
-            </state>
30
-          </provider>
31
-        </entry>
32
-      </file>
33
-      <file leaf-file-name="Checkbook.java" pinned="false" current-in-tab="false">
34
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
35
-          <provider selected="true" editor-type-id="text-editor">
36
-            <state relative-caret-position="0">
37
-              <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
38
-              <folding />
39
-            </state>
40
-          </provider>
41
-        </entry>
42
-      </file>
43
       <file leaf-file-name="README.md" pinned="false" current-in-tab="true">
23
       <file leaf-file-name="README.md" pinned="false" current-in-tab="true">
44
         <entry file="file://$PROJECT_DIR$/README.md">
24
         <entry file="file://$PROJECT_DIR$/README.md">
45
           <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
25
           <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
46
             <state split_layout="SPLIT">
26
             <state split_layout="SPLIT">
47
-              <first_editor relative-caret-position="527">
48
-                <caret line="31" column="21" lean-forward="false" selection-start-line="31" selection-start-column="21" selection-end-line="31" selection-end-column="21" />
27
+              <first_editor relative-caret-position="443">
28
+                <caret line="31" column="29" lean-forward="false" selection-start-line="31" selection-start-column="29" selection-end-line="31" selection-end-column="29" />
49
                 <folding />
29
                 <folding />
50
               </first_editor>
30
               </first_editor>
51
               <second_editor />
31
               <second_editor />
53
           </provider>
33
           </provider>
54
         </entry>
34
         </entry>
55
       </file>
35
       </file>
56
-      <file leaf-file-name="Transaction.java" pinned="false" current-in-tab="false">
57
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
58
-          <provider selected="true" editor-type-id="text-editor">
59
-            <state relative-caret-position="85">
60
-              <caret line="5" column="81" lean-forward="false" selection-start-line="5" selection-start-column="72" selection-end-line="5" selection-end-column="81" />
61
-              <folding>
62
-                <element signature="imports" expanded="true" />
63
-                <element signature="e#175#184#0" expanded="true" />
64
-                <element signature="e#661#662#0" expanded="true" />
65
-                <element signature="e#692#693#0" expanded="true" />
66
-                <element signature="e#726#727#0" expanded="true" />
67
-                <element signature="e#759#760#0" expanded="true" />
68
-                <element signature="e#790#791#0" expanded="true" />
69
-                <element signature="e#817#818#0" expanded="true" />
70
-                <element signature="e#857#858#0" expanded="true" />
71
-                <element signature="e#889#890#0" expanded="true" />
72
-                <element signature="e#920#921#0" expanded="true" />
73
-                <element signature="e#948#949#0" expanded="true" />
74
-                <element signature="e#989#990#0" expanded="true" />
75
-                <element signature="e#1023#1024#0" expanded="true" />
76
-              </folding>
77
-            </state>
78
-          </provider>
79
-        </entry>
80
-      </file>
81
-      <file leaf-file-name="TransactionType.java" pinned="false" current-in-tab="false">
82
-        <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java">
83
-          <provider selected="true" editor-type-id="text-editor">
84
-            <state relative-caret-position="0">
85
-              <caret line="0" column="27" lean-forward="false" selection-start-line="0" selection-start-column="12" selection-end-line="0" selection-end-column="27" />
86
-              <folding />
87
-            </state>
88
-          </provider>
89
-        </entry>
90
-      </file>
91
     </leaf>
36
     </leaf>
92
   </component>
37
   </component>
93
   <component name="FileTemplateManagerImpl">
38
   <component name="FileTemplateManagerImpl">
95
       <list>
40
       <list>
96
         <option value="JUnit4 Test Class" />
41
         <option value="JUnit4 Test Class" />
97
         <option value="Class" />
42
         <option value="Class" />
43
+        <option value="Interface" />
98
       </list>
44
       </list>
99
     </option>
45
     </option>
100
   </component>
46
   </component>
116
       <list>
62
       <list>
117
         <option value="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
63
         <option value="$PROJECT_DIR$/Checkbook/src/test/java/CheckbookTest.java" />
118
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
64
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Payee.java" />
119
-        <option value="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
120
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
65
         <option value="$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java" />
66
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java" />
67
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java" />
68
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java" />
69
+        <option value="$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java" />
121
         <option value="$PROJECT_DIR$/README.md" />
70
         <option value="$PROJECT_DIR$/README.md" />
122
       </list>
71
       </list>
123
     </option>
72
     </option>
319
       <option name="number" value="Default" />
268
       <option name="number" value="Default" />
320
       <option name="presentableId" value="Default" />
269
       <option name="presentableId" value="Default" />
321
       <updated>1543958631974</updated>
270
       <updated>1543958631974</updated>
322
-      <workItem from="1543958633447" duration="2457000" />
271
+      <workItem from="1543958633447" duration="2990000" />
323
     </task>
272
     </task>
324
     <servers />
273
     <servers />
325
   </component>
274
   </component>
326
   <component name="TimeTrackingManager">
275
   <component name="TimeTrackingManager">
327
-    <option name="totallyTimeSpent" value="2457000" />
276
+    <option name="totallyTimeSpent" value="2990000" />
328
   </component>
277
   </component>
329
   <component name="ToolWindowManager">
278
   <component name="ToolWindowManager">
330
     <frame x="91" y="61" width="1538" height="962" extended-state="0" />
279
     <frame x="91" y="61" width="1538" height="962" extended-state="0" />
406
         </state>
355
         </state>
407
       </provider>
356
       </provider>
408
     </entry>
357
     </entry>
409
-    <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
358
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/GenericAccount.java">
410
       <provider selected="true" editor-type-id="text-editor">
359
       <provider selected="true" editor-type-id="text-editor">
411
-        <state relative-caret-position="0">
412
-          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
360
+        <state relative-caret-position="17">
361
+          <caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
413
           <folding />
362
           <folding />
414
         </state>
363
         </state>
415
       </provider>
364
       </provider>
416
     </entry>
365
     </entry>
417
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java">
366
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/TransactionType.java">
418
       <provider selected="true" editor-type-id="text-editor">
367
       <provider selected="true" editor-type-id="text-editor">
419
-        <state relative-caret-position="0">
420
-          <caret line="0" column="27" lean-forward="false" selection-start-line="0" selection-start-column="12" selection-end-line="0" selection-end-column="27" />
368
+        <state relative-caret-position="17">
369
+          <caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
421
           <folding />
370
           <folding />
422
         </state>
371
         </state>
423
       </provider>
372
       </provider>
424
     </entry>
373
     </entry>
425
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
374
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Transaction.java">
426
       <provider selected="true" editor-type-id="text-editor">
375
       <provider selected="true" editor-type-id="text-editor">
427
-        <state relative-caret-position="85">
428
-          <caret line="5" column="81" lean-forward="false" selection-start-line="5" selection-start-column="72" selection-end-line="5" selection-end-column="81" />
376
+        <state relative-caret-position="442">
377
+          <caret line="26" column="18" lean-forward="true" selection-start-line="26" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
429
           <folding>
378
           <folding>
430
             <element signature="imports" expanded="true" />
379
             <element signature="imports" expanded="true" />
431
             <element signature="e#175#184#0" expanded="true" />
380
             <element signature="e#175#184#0" expanded="true" />
432
-            <element signature="e#661#662#0" expanded="true" />
433
-            <element signature="e#692#693#0" expanded="true" />
434
-            <element signature="e#726#727#0" expanded="true" />
435
-            <element signature="e#759#760#0" expanded="true" />
436
-            <element signature="e#790#791#0" expanded="true" />
437
-            <element signature="e#817#818#0" expanded="true" />
438
-            <element signature="e#857#858#0" expanded="true" />
439
-            <element signature="e#889#890#0" expanded="true" />
440
-            <element signature="e#920#921#0" expanded="true" />
441
-            <element signature="e#948#949#0" expanded="true" />
442
-            <element signature="e#989#990#0" expanded="true" />
443
-            <element signature="e#1023#1024#0" expanded="true" />
381
+            <element signature="e#259#270#0" expanded="true" />
382
+            <element signature="e#689#690#0" expanded="true" />
383
+            <element signature="e#720#721#0" expanded="true" />
384
+            <element signature="e#754#755#0" expanded="true" />
385
+            <element signature="e#787#788#0" expanded="true" />
386
+            <element signature="e#827#828#0" expanded="true" />
387
+            <element signature="e#855#856#0" expanded="true" />
388
+            <element signature="e#886#887#0" expanded="true" />
389
+            <element signature="e#913#914#0" expanded="true" />
390
+            <element signature="e#953#954#0" expanded="true" />
391
+            <element signature="e#985#986#0" expanded="true" />
392
+            <element signature="e#1016#1017#0" expanded="true" />
393
+            <element signature="e#1044#1045#0" expanded="true" />
394
+            <element signature="e#1085#1086#0" expanded="true" />
395
+            <element signature="e#1119#1120#0" expanded="true" />
444
           </folding>
396
           </folding>
445
         </state>
397
         </state>
446
       </provider>
398
       </provider>
447
     </entry>
399
     </entry>
400
+    <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/AccountBook.java">
401
+      <provider selected="true" editor-type-id="text-editor">
402
+        <state relative-caret-position="204">
403
+          <caret line="12" column="0" lean-forward="true" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
404
+          <folding />
405
+        </state>
406
+      </provider>
407
+    </entry>
448
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
408
     <entry file="file://$PROJECT_DIR$/Checkbook/src/main/java/Checkbook.java">
449
       <provider selected="true" editor-type-id="text-editor">
409
       <provider selected="true" editor-type-id="text-editor">
410
+        <state relative-caret-position="51">
411
+          <caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
412
+          <folding />
413
+        </state>
414
+      </provider>
415
+    </entry>
416
+    <entry file="file://$PROJECT_DIR$/Checkbook/pom.xml">
417
+      <provider selected="true" editor-type-id="text-editor">
450
         <state relative-caret-position="0">
418
         <state relative-caret-position="0">
451
           <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
419
           <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
452
           <folding />
420
           <folding />
456
     <entry file="file://$PROJECT_DIR$/README.md">
424
     <entry file="file://$PROJECT_DIR$/README.md">
457
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
425
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
458
         <state split_layout="SPLIT">
426
         <state split_layout="SPLIT">
459
-          <first_editor relative-caret-position="527">
460
-            <caret line="31" column="21" lean-forward="false" selection-start-line="31" selection-start-column="21" selection-end-line="31" selection-end-column="21" />
427
+          <first_editor relative-caret-position="443">
428
+            <caret line="31" column="29" lean-forward="false" selection-start-line="31" selection-start-column="29" selection-end-line="31" selection-end-column="29" />
461
             <folding />
429
             <folding />
462
           </first_editor>
430
           </first_editor>
463
           <second_editor />
431
           <second_editor />

+ 12
- 0
Checkbook/src/main/java/AccountBook.java View File

1
+import java.time.LocalDate;
2
+
3
+public interface AccountBook {
4
+    public Integer getId();
5
+    public LocalDate getDate();
6
+    public TransactionType getType();
7
+    public String getMemo() ;
8
+    public void setMemo(String memo);
9
+    public Payee getPayee();
10
+    public void setPayee(Payee payee);
11
+    public Double getAmount();
12
+}

+ 3
- 0
Checkbook/src/main/java/Checkbook.java View File

1
 public class Checkbook {
1
 public class Checkbook {
2
+
3
+    //blind us with your Java eloquence....
4
+
2
 }
5
 }

+ 3
- 0
Checkbook/src/main/java/GenericAccount.java View File

1
+
2
+public class GenericAccount {
3
+}

+ 5
- 0
Checkbook/src/main/java/Transaction.java View File

10
     private Double amount;
10
     private Double amount;
11
 
11
 
12
     public Transaction(String memo, Payee payee, TransactionType typee, Double amount) {
12
     public Transaction(String memo, Payee payee, TransactionType typee, Double amount) {
13
+        this.typee = typee;
13
         this.memo = memo;
14
         this.memo = memo;
14
         this.payee = payee;
15
         this.payee = payee;
15
         this.amount = amount;
16
         this.amount = amount;
23
         return date.get();
24
         return date.get();
24
     }
25
     }
25
 
26
 
27
+    public TransactionType getType() {
28
+        return typee;
29
+    }
30
+
26
     public String getMemo() {
31
     public String getMemo() {
27
         return memo;
32
         return memo;
28
     }
33
     }

+ 1
- 0
Checkbook/src/main/java/TransactionType.java View File

1
+
1
 public enum TransactionType {
2
 public enum TransactionType {
2
     DEBIT,
3
     DEBIT,
3
     CREDIT;
4
     CREDIT;

+ 4
- 0
README.md View File

28
  * double checkbookValue() // sum of all Transactions (both Debits and Credits)
28
  * double checkbookValue() // sum of all Transactions (both Debits and Credits)
29
  * Transaction getTransactionsForDate(LocalDate aDate)
29
  * Transaction getTransactionsForDate(LocalDate aDate)
30
  * Transaction[] getAllTransactionsForPayee(Payee payee)
30
  * Transaction[] getAllTransactionsForPayee(Payee payee)
31
+ * Transaction[] getAllDebitTransactions()
32
+ * Transaction[] getAllCreditTransactions()
31
  
33
  
32
  Special Constructors:
34
  Special Constructors:
33
  * Checkbook(double cashAmount)
35
  * Checkbook(double cashAmount)
40
  * boolean addAll(Collection<Transaction> c)
42
  * boolean addAll(Collection<Transaction> c)
41
  * boolean removeAll(Collection<Transaction> c)
43
  * boolean removeAll(Collection<Transaction> c)
42
  * void clear()
44
  * void clear()
45
+
46
+finally, make a generic account class, that takes any class which implements the AccountBook interface.