|
@@ -4,6 +4,8 @@ the second Objects lab.
|
4
|
4
|
|
5
|
5
|
look for the Chapter reading you need in the doc folder.
|
6
|
6
|
|
|
7
|
+Work through all these exercises.
|
|
8
|
+
|
7
|
9
|
* Exercise 2.1 Create a TicketMachine object on the object bench and take a look
|
8
|
10
|
at its methods. You should see the following: getBalance, getPrice, insertMoney,
|
9
|
11
|
and printTicket. Try out the getPrice method. You should see a return value containing
|
|
@@ -63,7 +65,9 @@ private Person tutor;
|
63
|
65
|
private Game game;
|
64
|
66
|
```
|
65
|
67
|
* Exercise 2.13 In the following field declaration from the TicketMachine class
|
66
|
|
-`private int price;`
|
|
68
|
+```
|
|
69
|
+private int price;
|
|
70
|
+```
|
67
|
71
|
does it matter which order the three words appear in? Edit the TicketMachine class to
|
68
|
72
|
try different orderings. After each change, close the editor. Does the appearance of the
|
69
|
73
|
class diagram after each change give you a clue as to whether or not other orderings are
|
|
@@ -78,8 +82,11 @@ status.
|
78
|
82
|
```
|
79
|
83
|
public Student(String name)
|
80
|
84
|
```
|
81
|
|
-* Exercise 2.17 How many parameters does the following constructor have andwhat are their types?
|
|
85
|
+* Exercise 2.17 How many parameters does the following constructor have and what are their types?
|
82
|
86
|
```
|
83
|
87
|
public Book(String title, double price)
|
84
|
88
|
```
|
85
|
|
-* Exercise 2.18 Can you guess what types some of the Bookclass’s fields mightbe? Can you assume anything about the names of its fields?
|
|
89
|
+* Exercise 2.18 Can you guess what types some of the Book class’s fields might be? Can you assume anything about the names of its fields?
|
|
90
|
+
|
|
91
|
+Work all Exercises from 2.19 to 2.58 that are NOT marked *Challenge exercise*.
|
|
92
|
+READ upto and INCLUDING section 2.15 of this chapter.
|