|
Spring Semester 2003 |
1. Draw this:
|
Don't forget the blueprint:
|
2. Draw this:
|
Notice that the blueprint is no longer empty. |
3. Draw this:
|
Easy. |
4. Draw this:
|
|
5. Draw this:
|
|
6. Draw this:
|
|
7. Draw this:
|
| For this the picture is bigger: |
|
8. Draw this:
|
Same as above only main no longer is empty.
|
|
9. Draw this:
|
|
10. Draw this:
|
|
11. Draw this:
|
|
12. Draw this:
|
|
| 13. Now write this: |
Create two accounts for Doug and Adrian. Initial balance for any account is 10. Then Doug's account doubles, Adrian's decreases by 3, and Doug's account has one more dollar deposited to it.
| Let me try it. How about this? |
class Account {
double balance = 10;
public static void main(String[] args) {
Account doug, adrian;
doug = new Account();
adrian = new Account();
doug.balance = doug.balance * 3;
adrian.balance -= 3;
doug.balance++;
}
}
| Looks good. | Thank you. |
14. Draw this:
|
| This is similar to what we drew at step 12. |
15. Draw this:
|
|
16. Draw this:
|
|
17. Draw this:
|
|
18. Draw this:
|
|
Speaking of this can I show you an example?
|
| Sure, go ahead. | Here it is: |
class Speakers {
public static void main(String[] args) {
Speaker a = new Speaker("Larry");
Speaker b = new Speaker("Michael");
Speaker c = new Speaker("Tony");
a.talk();
b.talk();
c.talk();
}
}
class Speaker {
String speaker;
Speaker (String name) {
speaker = name;
}
void talk() {
System.out.println(this.speaker + " is very happy.");
}
| Very nice. |
Thanks. this writer is very happy.
|
| 19. Write this: |
|
20. Draw this:
| Funny. |
21. Draw this:
|
|
22. Draw this:
|
| Oh, this is almost entirely exactly the same. |
23. Draw this:
|
|
24. Draw this:
|
|
| This last one was rather easy. |