Christian Sheridan vor 6 Jahren
Ursprung
Commit
1a79236cef
3 geänderte Dateien mit 46 neuen und 32 gelöschten Zeilen
  1. 28
    4
      TicketMachine.java
  2. 9
    14
      bluej.pkg
  3. 9
    14
      package.bluej

+ 28
- 4
TicketMachine.java Datei anzeigen

@@ -1,3 +1,5 @@
1
+package NaiveTicket;
2
+
1 3
 /**
2 4
  * TicketMachine models a naive ticket machine that issues
3 5
  * flat-fare tickets.
@@ -9,7 +11,7 @@
9 11
  * @author David J. Barnes and Michael Kolling
10 12
  * @version 2008.03.30
11 13
  */
12
-public class TicketMachine
14
+ class TicketMachine
13 15
 {
14 16
     // The price of a ticket from this machine.
15 17
     private int price;
@@ -17,19 +19,41 @@ public class TicketMachine
17 19
     private int balance;
18 20
     // The total amount of money collected by this machine.
19 21
     private int total;
22
+    // The status of the ticket machine
23
+    private int status;
20 24
 
21 25
     /**
22 26
      * Create a machine that issues tickets of the given price.
23 27
      * Note that the price must be greater than zero, and there
24 28
      * are no checks to ensure this.
25 29
      */
26
-    public TicketMachine(int ticketCost)
30
+    public TicketMachine()
27 31
     {
28
-        price = ticketCost;
32
+        price = 1000;
29 33
         balance = 0;
30 34
         total = 0;
31 35
     }
32
-
36
+    
37
+    
38
+    public void empty ()
39
+    {
40
+     total = 0;   
41
+    }
42
+    //Money prompt
43
+    public void prompt () 
44
+    {
45
+        System.out.println("Please insert the correct amount of money");
46
+    }
47
+    
48
+    //show price prompt
49
+    public void showPrice () {
50
+     System.out.println("The price of a ticket is " + price + " cents");  
51
+    }
52
+    
53
+    public void setPrice (int ticketCost)
54
+    {
55
+        ticketCost = price;
56
+    }
33 57
     /**
34 58
      * Return the price of a ticket.
35 59
      */

+ 9
- 14
bluej.pkg Datei anzeigen

@@ -1,23 +1,18 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=722
3
-editor.fx.0.width=800
4
-editor.fx.0.x=709
5
-editor.fx.0.y=113
6 2
 objectbench.height=101
7
-objectbench.width=461
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
3
+objectbench.width=669
4
+package.divider.horizontal=0.5998225377107365
5
+package.divider.vertical=0.8658385093167702
6
+package.editor.height=690
7
+package.editor.width=1021
8
+package.editor.x=165
9
+package.editor.y=37
10
+package.frame.height=863
11
+package.frame.width=1147
16 12
 package.numDependencies=0
17 13
 package.numTargets=1
18 14
 package.showExtends=true
19 15
 package.showUses=true
20
-project.charset=UTF-8
21 16
 readme.height=58
22 17
 readme.name=@README
23 18
 readme.width=47

+ 9
- 14
package.bluej Datei anzeigen

@@ -1,23 +1,18 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=722
3
-editor.fx.0.width=800
4
-editor.fx.0.x=709
5
-editor.fx.0.y=113
6 2
 objectbench.height=101
7
-objectbench.width=461
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
3
+objectbench.width=669
4
+package.divider.horizontal=0.5998225377107365
5
+package.divider.vertical=0.8658385093167702
6
+package.editor.height=690
7
+package.editor.width=1021
8
+package.editor.x=165
9
+package.editor.y=37
10
+package.frame.height=863
11
+package.frame.width=1147
16 12
 package.numDependencies=0
17 13
 package.numTargets=1
18 14
 package.showExtends=true
19 15
 package.showUses=true
20
-project.charset=UTF-8
21 16
 readme.height=58
22 17
 readme.name=@README
23 18
 readme.width=47