Kris Blassingame 6 years ago
parent
commit
d219131373
4 changed files with 45 additions and 21 deletions
  1. BIN
      .DS_Store
  2. 27
    3
      TicketMachine.java
  3. 9
    9
      bluej.pkg
  4. 9
    9
      package.bluej

BIN
.DS_Store View File


+ 27
- 3
TicketMachine.java View File

@@ -9,7 +9,7 @@
9 9
  * @author David J. Barnes and Michael Kolling
10 10
  * @version 2008.03.30
11 11
  */
12
-public class TicketMachine
12
+class TicketMachine
13 13
 {
14 14
     // The price of a ticket from this machine.
15 15
     private int price;
@@ -23,11 +23,12 @@ public class TicketMachine
23 23
      * Note that the price must be greater than zero, and there
24 24
      * are no checks to ensure this.
25 25
      */
26
-    public TicketMachine(int ticketCost)
26
+    public TicketMachine()
27 27
     {
28
-        price = ticketCost;
28
+        price = 1000;
29 29
         balance = 0;
30 30
         total = 0;
31
+        int status;
31 32
     }
32 33
 
33 34
     /**
@@ -75,4 +76,27 @@ public class TicketMachine
75 76
         // Clear the balance.
76 77
         balance = 0;
77 78
     }
79
+    
80
+    public int getTotal() {
81
+        return total;
82
+    }
83
+    
84
+    public void prompt() {
85
+        System.out.println("Please insert the correct amount of money.");
86
+    }
87
+    
88
+    public void showPrice(){
89
+        System.out.println("The price of a ticket is " + price + " cents.");
90
+    }
91
+    
92
+    public void empty(){
93
+        total = 0;
94
+    }
95
+    
96
+    public void setPrice(int newPrice){
97
+        price = newPrice;
98
+    }
99
+   
78 100
 }
101
+
102
+

+ 9
- 9
bluej.pkg View 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=738
4
+editor.fx.0.x=702
5
+editor.fx.0.y=74
6 6
 objectbench.height=101
7
-objectbench.width=461
8
-package.divider.horizontal=0.6
7
+objectbench.width=424
8
+package.divider.horizontal=0.6002785515320335
9 9
 package.divider.vertical=0.8007380073800738
10 10
 package.editor.height=427
11
-package.editor.width=674
12
-package.editor.x=1067
13
-package.editor.y=119
11
+package.editor.width=612
12
+package.editor.x=702
13
+package.editor.y=218
14 14
 package.frame.height=600
15
-package.frame.width=800
15
+package.frame.width=738
16 16
 package.numDependencies=0
17 17
 package.numTargets=1
18 18
 package.showExtends=true

+ 9
- 9
package.bluej View 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=738
4
+editor.fx.0.x=702
5
+editor.fx.0.y=74
6 6
 objectbench.height=101
7
-objectbench.width=461
8
-package.divider.horizontal=0.6
7
+objectbench.width=424
8
+package.divider.horizontal=0.6002785515320335
9 9
 package.divider.vertical=0.8007380073800738
10 10
 package.editor.height=427
11
-package.editor.width=674
12
-package.editor.x=1067
13
-package.editor.y=119
11
+package.editor.width=612
12
+package.editor.x=702
13
+package.editor.y=218
14 14
 package.frame.height=600
15
-package.frame.width=800
15
+package.frame.width=738
16 16
 package.numDependencies=0
17 17
 package.numTargets=1
18 18
 package.showExtends=true