Comp 170 Lab 0 - Hello World / shapes

Goals

Part 1: 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 (or copy-paste it from this window) so that it looks something like this:

public class Hello {
   public void hi() {
      String s = "Hell";
      System.out.print(s + 'o' + ' ');
      System.out.println("World!");
   }
}
Edit the source to 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, and choose the new Hello() menu option to create an instance on the object bench. Then, on that red instance icon, rightclick and choose the hi() method; if all goes well you should get some output.

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

Part 2: 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. Your shapes do not have to relate to one another or form a picture (that's next week's lab). 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?

Again, show your shapes on the screen to either me or Maria.