Joshua Chung 6 anni fa
parent
commit
bfbd8ddc88
4 ha cambiato i file con 84 aggiunte e 22 eliminazioni
  1. 20
    0
      TicketMachine.java
  2. 42
    0
      TicketMachineTest.java
  3. 11
    11
      bluej.pkg
  4. 11
    11
      package.bluej

+ 20
- 0
TicketMachine.java Vedi File

@@ -54,6 +54,26 @@ public class TicketMachine
54 54
     {
55 55
         balance = balance + amount;
56 56
     }
57
+    
58
+    public int getTotal() {
59
+        return total;
60
+    }
61
+    
62
+    public void getPrompt(){
63
+        System.out.println("Please insert the correct amount of money.");
64
+    }
65
+    
66
+    public void showPrice(){
67
+        System.out.println("# " + price + " cents.");
68
+    }
69
+    
70
+    public void setEmpty(){
71
+        total = 0;
72
+    }
73
+    
74
+    public void setPrice(int newPrice){
75
+        price = newPrice;
76
+    }
57 77
 
58 78
     /**
59 79
      * Print a ticket.

+ 42
- 0
TicketMachineTest.java Vedi File

@@ -0,0 +1,42 @@
1
+
2
+
3
+import static org.junit.Assert.*;
4
+import org.junit.After;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+/**
9
+ * The test class TicketMachineTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class TicketMachineTest
15
+{
16
+    /**
17
+     * Default constructor for test class TicketMachineTest
18
+     */
19
+    public TicketMachineTest()
20
+    {
21
+    }
22
+
23
+    /**
24
+     * Sets up the test fixture.
25
+     *
26
+     * Called before every test case method.
27
+     */
28
+    @Before
29
+    public void setUp()
30
+    {
31
+    }
32
+
33
+    /**
34
+     * Tears down the test fixture.
35
+     *
36
+     * Called after every test case method.
37
+     */
38
+    @After
39
+    public void tearDown()
40
+    {
41
+    }
42
+}

+ 11
- 11
bluej.pkg Vedi File

@@ -1,18 +1,18 @@
1 1
 #BlueJ package file
2 2
 editor.fx.0.height=722
3
-editor.fx.0.width=800
4
-editor.fx.0.x=709
5
-editor.fx.0.y=113
3
+editor.fx.0.width=733
4
+editor.fx.0.x=1280
5
+editor.fx.0.y=214
6 6
 objectbench.height=101
7
-objectbench.width=461
7
+objectbench.width=709
8 8
 package.divider.horizontal=0.6
9
-package.divider.vertical=0.8007380073800738
10
-package.editor.height=427
11
-package.editor.width=674
12
-package.editor.x=1067
13
-package.editor.y=119
14
-package.frame.height=600
15
-package.frame.width=800
9
+package.divider.vertical=0.8838709677419355
10
+package.editor.height=815
11
+package.editor.width=607
12
+package.editor.x=1280
13
+package.editor.y=23
14
+package.frame.height=988
15
+package.frame.width=733
16 16
 package.numDependencies=0
17 17
 package.numTargets=1
18 18
 package.showExtends=true

+ 11
- 11
package.bluej Vedi File

@@ -1,18 +1,18 @@
1 1
 #BlueJ package file
2 2
 editor.fx.0.height=722
3
-editor.fx.0.width=800
4
-editor.fx.0.x=709
5
-editor.fx.0.y=113
3
+editor.fx.0.width=733
4
+editor.fx.0.x=1280
5
+editor.fx.0.y=214
6 6
 objectbench.height=101
7
-objectbench.width=461
7
+objectbench.width=709
8 8
 package.divider.horizontal=0.6
9
-package.divider.vertical=0.8007380073800738
10
-package.editor.height=427
11
-package.editor.width=674
12
-package.editor.x=1067
13
-package.editor.y=119
14
-package.frame.height=600
15
-package.frame.width=800
9
+package.divider.vertical=0.8838709677419355
10
+package.editor.height=815
11
+package.editor.width=607
12
+package.editor.x=1280
13
+package.editor.y=23
14
+package.frame.height=988
15
+package.frame.width=733
16 16
 package.numDependencies=0
17 17
 package.numTargets=1
18 18
 package.showExtends=true