Vincent Sima 6 vuotta sitten
vanhempi
commit
007b384555
4 muutettua tiedostoa jossa 30 lisäystä ja 12 poistoa
  1. BIN
      .DS_Store
  2. 20
    2
      TicketMachine.java
  3. 5
    5
      bluej.pkg
  4. 5
    5
      package.bluej

BIN
.DS_Store Näytä tiedosto


+ 20
- 2
TicketMachine.java Näytä tiedosto

@@ -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;
@@ -17,6 +17,7 @@ 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
+    private int status;
20 21
 
21 22
     /**
22 23
      * Create a machine that issues tickets of the given price.
@@ -29,6 +30,18 @@ public class TicketMachine
29 30
         balance = 0;
30 31
         total = 0;
31 32
     }
33
+        
34
+        public void prompt()
35
+        {
36
+        System.out.println("Please insert the correct amount of money.");
37
+    }
38
+    
39
+        public void showPrice()
40
+         {
41
+        System.out.println("The price of a ticket is " + price + " cents.");
42
+    }
43
+    
44
+    
32 45
 
33 46
     /**
34 47
      * Return the price of a ticket.
@@ -46,7 +59,7 @@ public class TicketMachine
46 59
     {
47 60
         return balance;
48 61
     }
49
-
62
+    
50 63
     /**
51 64
      * Receive an amount of money in cents from a customer.
52 65
      */
@@ -55,6 +68,11 @@ public class TicketMachine
55 68
         balance = balance + amount;
56 69
     }
57 70
 
71
+    public int getTotal()
72
+    {
73
+        return total;
74
+    }
75
+    
58 76
     /**
59 77
      * Print a ticket.
60 78
      * Update the total collected and

+ 5
- 5
bluej.pkg Näytä tiedosto

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

+ 5
- 5
package.bluej Näytä tiedosto

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