Quellcode durchsuchen

Randall G Naive complete

Randall Gibson Jr vor 6 Jahren
Ursprung
Commit
1dc5940abd
4 geänderte Dateien mit 44 neuen und 21 gelöschten Zeilen
  1. BIN
      .DS_Store
  2. 26
    3
      TicketMachine.java
  3. 9
    9
      bluej.pkg
  4. 9
    9
      package.bluej

BIN
.DS_Store Datei anzeigen


+ 26
- 3
TicketMachine.java Datei anzeigen

@@ -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
+ public class TicketMachine
13 13
 {
14 14
     // The price of a ticket from this machine.
15 15
     private int price;
@@ -17,15 +17,17 @@ public class TicketMachine
17 17
     private int balance;
18 18
     // The total amount of money collected by this machine.
19 19
     private int total;
20
+    
21
+    private int status;
20 22
 
21 23
     /**
22 24
      * Create a machine that issues tickets of the given price.
23 25
      * Note that the price must be greater than zero, and there
24 26
      * are no checks to ensure this.
25 27
      */
26
-    public TicketMachine(int ticketCost)
28
+    public TicketMachine()
27 29
     {
28
-        price = ticketCost;
30
+        price = 1000;
29 31
         balance = 0;
30 32
         total = 0;
31 33
     }
@@ -75,4 +77,25 @@ public class TicketMachine
75 77
         // Clear the balance.
76 78
         balance = 0;
77 79
     }
80
+    
81
+    public void prompt()
82
+    {
83
+        System.out.println("Please insert the correct amount of money.");
84
+    }
85
+    public void showPrice()
86
+    {
87
+        System.out.println("The price of a ticket is " + price + " cents.");
88
+        
78 89
 }
90
+    public void empty()
91
+    {
92
+        total = total + balance;
93
+        balance = 0;
94
+    }
95
+    
96
+    public void setPrice(int set)
97
+    {
98
+        price = set;
99
+    }
100
+        
101
+    }

+ 9
- 9
bluej.pkg Datei anzeigen

@@ -1,16 +1,16 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=722
2
+editor.fx.0.height=709
3 3
 editor.fx.0.width=800
4
-editor.fx.0.x=709
5
-editor.fx.0.y=113
6
-objectbench.height=101
7
-objectbench.width=461
4
+editor.fx.0.x=252
5
+editor.fx.0.y=23
6
+objectbench.height=164
7
+objectbench.width=776
8 8
 package.divider.horizontal=0.6
9
-package.divider.vertical=0.8007380073800738
10
-package.editor.height=427
9
+package.divider.vertical=0.6845018450184502
10
+package.editor.height=364
11 11
 package.editor.width=674
12
-package.editor.x=1067
13
-package.editor.y=119
12
+package.editor.x=412
13
+package.editor.y=108
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0

+ 9
- 9
package.bluej Datei anzeigen

@@ -1,16 +1,16 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=722
2
+editor.fx.0.height=709
3 3
 editor.fx.0.width=800
4
-editor.fx.0.x=709
5
-editor.fx.0.y=113
6
-objectbench.height=101
7
-objectbench.width=461
4
+editor.fx.0.x=252
5
+editor.fx.0.y=23
6
+objectbench.height=164
7
+objectbench.width=776
8 8
 package.divider.horizontal=0.6
9
-package.divider.vertical=0.8007380073800738
10
-package.editor.height=427
9
+package.divider.vertical=0.6845018450184502
10
+package.editor.height=364
11 11
 package.editor.width=674
12
-package.editor.x=1067
13
-package.editor.y=119
12
+package.editor.x=412
13
+package.editor.y=108
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0