CSE 12: Survey of Computer Science
Assignment #4 (Java)

Last week you learned about programming languages and took a brief look at C++. This week you will start learning about Java, a widely used object-oriented programming language, using BlueJ, a programming environment designed for beginners, and multimedia from The Universal Computer which corresponds to the content of chapter 1 from David Barnes and Michael Kölling's Objects First With Java. (Kölling is the leader developer of BlueJ.) In next week's lab, you will work in pairs on exercises from chapter 2 of this book. Both chapters are available under Course Documents.

Laboratory work for 9/15:
Start the multimedia with Start>Run ucSetup--this will copy some Java programs onto your H: drive, set up the BlueJ button and launch The Universal Computer. Your objective this week is complete the multimedia for Objects and Classes (at the bottom of the chapters list) in The Universal Computer.

Do all the exercises, including the BlueJ exercises as described in the multimedia. Before you leave, show the Java programs that you modify to the teaching assistant. You should modify programs in H:\ucomp\chap3. You will study and modify programs in H:\ucomp\chap3\shapes and H:\ucomp\chap3\picture.

Homework exercises:
The first two chapters corresponding to the multimedia is available under Course Documents. The following exercises correspond to the multimedia, but are recommended for review. Write down notes in response to each question in the exercises, and save any programs you modify. You will hand your notes and program in as part of your next assignment due next Monday, along with your work in next week's lab, described below.

Follow the instructions on the bottom of page 4, to create a Circle.
On page 5, do exercise 1.1.
On page 6, do exercise 1.2 and 1.3.
On page 7, do exercises 1.4 and 1.6.
On page 8, do exercise 1.8.
On page 10, do exercise 1.10, the picture program. (It's in C:\ucomp\chap3\picture.)
On pages 11-12, do exercises 1.12, 1.13 and 1.14. For 1.14, also add a second window to the house in the picture.
Note: for exercises 1.13 and 1.14 above and 1.15 below, use // to indicate changes you made to the Picture program, for example,
//Changed for exercise 1.13
On page 12, do exercise 1.15

Laboratory work for 9/22 (based on chapter 2 of Objects First With Java: Understanding Class Definitions)
Make sure you have copied Picture.java to another folder before you run ucsetup again.
This week, first rename folder H:\ucomp\chap3 to something like H:\ucomp\javalab1 to save your work from last week.
Then point Internet Explorer to cimel.cse.lehigh.edu/ucsetup.exe and run the setup program.
Among other things, it will now install a new folder, H:\ucomp\chapter02, in which you will find the BlueJ projects for chapter 2.
You can launch BlueJ from The Universal Computer or Start>Run bluej, then Open project>naive-ticket-machine.
Course Documents contains chapter 2 of Objects First With Java: Understanding Class Definitions as a PDF file.
It's recommended that you work in pairs in this lab, especially when you are writing code.
In The Universal Computer multimedia, use the find button to search for pair programming, and press Show Flash to view this page.
When you submit your work, indicate who your partner is.
(Note: you may only work as partners when an assignment says so, explicitly, as in this week's lab.)

On page 18, do exercises 2.1, 2.2, 2.3, 2.4, 2.5.
On page 22, do exercise 2.8.
On page 29, do exercise 2.12.
On page 30, do exercise 2.16.
On page 31, do exercises 2.17, 2.18.
On page 33, do exercises 2.20, 2.21.
On page 34, do exercises 2.26, 2.27.
On page 38, do exercises 2.29, 2.30.

Due: Monday, 9/22, anytime before midnight.

Hand in: When you're ready to submit your assignment, combine the answers to all the exercises (including source code for the programming exercises) into one text file. Then, attach your file to assignment #4 (where you got this assignment) in Blackboard.

Prof. Blank