Bläddra i källkod

change Transaction

Kr Younger 6 år sedan
förälder
incheckning
e57770a9a9

+ 44
- 0
Checkbook/.classpath Visa fil

@@ -0,0 +1,44 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
4
+		<attributes>
5
+			<attribute name="optional" value="true"/>
6
+			<attribute name="maven.pomderived" value="true"/>
7
+		</attributes>
8
+	</classpathentry>
9
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10
+		<attributes>
11
+			<attribute name="optional" value="true"/>
12
+			<attribute name="maven.pomderived" value="true"/>
13
+			<attribute name="test" value="true"/>
14
+		</attributes>
15
+	</classpathentry>
16
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
17
+		<attributes>
18
+			<attribute name="maven.pomderived" value="true"/>
19
+		</attributes>
20
+	</classpathentry>
21
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
22
+		<attributes>
23
+			<attribute name="maven.pomderived" value="true"/>
24
+		</attributes>
25
+	</classpathentry>
26
+	<classpathentry kind="src" path="target/generated-sources/annotations">
27
+		<attributes>
28
+			<attribute name="optional" value="true"/>
29
+			<attribute name="maven.pomderived" value="true"/>
30
+			<attribute name="ignore_optional_problems" value="true"/>
31
+			<attribute name="m2e-apt" value="true"/>
32
+		</attributes>
33
+	</classpathentry>
34
+	<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
35
+		<attributes>
36
+			<attribute name="optional" value="true"/>
37
+			<attribute name="maven.pomderived" value="true"/>
38
+			<attribute name="ignore_optional_problems" value="true"/>
39
+			<attribute name="m2e-apt" value="true"/>
40
+			<attribute name="test" value="true"/>
41
+		</attributes>
42
+	</classpathentry>
43
+	<classpathentry kind="output" path="target/classes"/>
44
+</classpath>

+ 23
- 0
Checkbook/.project Visa fil

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>Checkbook</name>
4
+	<comment></comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.jdt.core.javabuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>org.eclipse.m2e.core.maven2Builder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+	</buildSpec>
19
+	<natures>
20
+		<nature>org.eclipse.jdt.core.javanature</nature>
21
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
22
+	</natures>
23
+</projectDescription>

+ 2
- 0
Checkbook/.settings/org.eclipse.jdt.apt.core.prefs Visa fil

@@ -0,0 +1,2 @@
1
+eclipse.preferences.version=1
2
+org.eclipse.jdt.apt.aptEnabled=false

+ 7
- 0
Checkbook/.settings/org.eclipse.jdt.core.prefs Visa fil

@@ -0,0 +1,7 @@
1
+eclipse.preferences.version=1
2
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3
+org.eclipse.jdt.core.compiler.compliance=1.8
4
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
6
+org.eclipse.jdt.core.compiler.release=disabled
7
+org.eclipse.jdt.core.compiler.source=1.8

+ 4
- 0
Checkbook/.settings/org.eclipse.m2e.core.prefs Visa fil

@@ -0,0 +1,4 @@
1
+activeProfiles=
2
+eclipse.preferences.version=1
3
+resolveWorkspaceProjects=true
4
+version=1

+ 5
- 2
Checkbook/src/main/java/Transaction.java Visa fil

@@ -1,15 +1,18 @@
1
-import java.time.LocalDate;
1
+import java.util.Date;
2 2
 import java.util.concurrent.atomic.AtomicReference;
3 3
 
4 4
 public class Transaction {
5 5
     private final AtomicReference<Integer> id = new AtomicReference<Integer>();
6
-    private final AtomicReference<LocalDate> date = new AtomicReference<LocalDate>();
6
+    private final Date d = new java.util.Date();
7 7
     private String memo;
8 8
     private Payee payee;
9 9
     private TransactionType typee; // Credit (reduces the checkbook), Debit (increases the checkbook)
10 10
     private Double amount;
11
+    private static int serialnumber =  100;
11 12
 
12 13
     public Transaction(String memo, Payee payee, TransactionType typee, Double amount) {
14
+        serialnumber += 1;
15
+        this.id.set(serialnumber);
13 16
         this.typee = typee;
14 17
         this.memo = memo;
15 18
         this.payee = payee;