Comp 170 Lab 0 - Hello World / shapes

Goals

The Hello, World! project.

Login to windoze and start BlueJ. It should be somewhere reachable from the start menu. Select Project => New_Project. Now comes the hard part: figure out where to save your project. There's some temp space somewhere on those machines, but it won't be yours for long. You can fit BlueJ projects on a floppy, too, though running them from there will be sloooow. Your best bet is to have one of those flash-drive USB things, at least if, unlike me, you're not the kind of person to leave it behind in the lab.

Wherever you save your project, put it in its own folder!.

You should see a BlueJ screen with one text icon. Click on the new class button at the left, and after entering a name you should see an orange "class box". Doubleclick on that, and edit the text so that it looks something like this:

public class Hello {
   public static void main(String[] args) {
      String s = "Hell";
      System.out.print(s + 'o' + ' ');
      System.out.println("World!");
   }
}
Add a comment expressing the importance of not leaving out the 'o'.

Click the Compile button to compile. Then go to the main project window, rightclick on your orange program icon, choose the void main(String[]) menu option, and if all goes well you should get some output.

Show your project to either me or the TA. Be sure we make a note of it!

Shapes

Click here to get the shapes.zip file. Save it (somewhere), unzip it (somehow) into its own folder, and use BlueJ to open the project. This project is from Chapter 1 of the book. Create one instance of each shape and at least two of one of the shapes, and make them all visible, and move them around. Be sure to try Think about the difference bewteen classes (the orange boxes above) and instances (the red round-cornered boxes below). Also think about what happens if you don't supply the right parameters, such as moveHorizontal("xyzzy") or changeColor("xyzzy"). Note that there is a major difference between these last two; what is it?