Browse Source

NaiveTicket

NiraParikh 6 years ago
parent
commit
cc432c7f35
4 changed files with 38 additions and 37 deletions
  1. BIN
      .DS_Store
  2. 4
    3
      TicketMachine.java
  3. 17
    17
      bluej.pkg
  4. 17
    17
      package.bluej

BIN
.DS_Store View File


+ 4
- 3
TicketMachine.java View File

1
+ 
2
+
1
 /**
3
 /**
2
  * TicketMachine models a naive ticket machine that issues
4
  * TicketMachine models a naive ticket machine that issues
3
  * flat-fare tickets.
5
  * flat-fare tickets.
9
  * @author David J. Barnes and Michael Kolling
11
  * @author David J. Barnes and Michael Kolling
10
  * @version 2008.03.30
12
  * @version 2008.03.30
11
  */
13
  */
12
-public class TicketMachine
14
+ public class TicketMachine
13
 {
15
 {
14
     // The price of a ticket from this machine.
16
     // The price of a ticket from this machine.
15
     private int price;
17
     private int price;
17
     private int balance;
19
     private int balance;
18
     // The total amount of money collected by this machine.
20
     // The total amount of money collected by this machine.
19
     private int total;
21
     private int total;
20
-
21
     /**
22
     /**
22
      * Create a machine that issues tickets of the given price.
23
      * Create a machine that issues tickets of the given price.
23
      * Note that the price must be greater than zero, and there
24
      * Note that the price must be greater than zero, and there
26
     public TicketMachine(int ticketCost)
27
     public TicketMachine(int ticketCost)
27
     {
28
     {
28
         price = ticketCost;
29
         price = ticketCost;
29
-        balance = 0;
30
+        balance = 10;
30
         total = 0;
31
         total = 0;
31
     }
32
     }
32
 
33
 

+ 17
- 17
bluej.pkg View File

1
 #BlueJ package file
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
-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
2
+editor.fx.0.height=0
3
+editor.fx.0.width=0
4
+editor.fx.0.x=0
5
+editor.fx.0.y=0
6
+objectbench.height=258
7
+objectbench.width=348
8
+package.divider.horizontal=0.5996621621621622
9
+package.divider.vertical=0.5929339477726574
10
+package.editor.height=379
11
+package.editor.width=486
12
+package.editor.x=208
13
+package.editor.y=233
14
+package.frame.height=709
15
+package.frame.width=612
16
 package.numDependencies=0
16
 package.numDependencies=0
17
 package.numTargets=1
17
 package.numTargets=1
18
 package.showExtends=true
18
 package.showExtends=true
23
 readme.width=47
23
 readme.width=47
24
 readme.x=10
24
 readme.x=10
25
 readme.y=10
25
 readme.y=10
26
-target1.height=50
26
+target1.height=90
27
 target1.name=TicketMachine
27
 target1.name=TicketMachine
28
 target1.showInterface=false
28
 target1.showInterface=false
29
 target1.type=ClassTarget
29
 target1.type=ClassTarget
30
-target1.width=120
31
-target1.x=80
30
+target1.width=180
31
+target1.x=110
32
 target1.y=50
32
 target1.y=50

+ 17
- 17
package.bluej View File

1
 #BlueJ package file
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
-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
2
+editor.fx.0.height=0
3
+editor.fx.0.width=0
4
+editor.fx.0.x=0
5
+editor.fx.0.y=0
6
+objectbench.height=258
7
+objectbench.width=348
8
+package.divider.horizontal=0.5996621621621622
9
+package.divider.vertical=0.5929339477726574
10
+package.editor.height=379
11
+package.editor.width=486
12
+package.editor.x=208
13
+package.editor.y=233
14
+package.frame.height=709
15
+package.frame.width=612
16
 package.numDependencies=0
16
 package.numDependencies=0
17
 package.numTargets=1
17
 package.numTargets=1
18
 package.showExtends=true
18
 package.showExtends=true
23
 readme.width=47
23
 readme.width=47
24
 readme.x=10
24
 readme.x=10
25
 readme.y=10
25
 readme.y=10
26
-target1.height=50
26
+target1.height=90
27
 target1.name=TicketMachine
27
 target1.name=TicketMachine
28
 target1.showInterface=false
28
 target1.showInterface=false
29
 target1.type=ClassTarget
29
 target1.type=ClassTarget
30
-target1.width=120
31
-target1.x=80
30
+target1.width=180
31
+target1.x=110
32
 target1.y=50
32
 target1.y=50