Business Programming

Course announcements for INFS1609 and INFS2609

Business Programming random header image

Tutorial Week 2 – Getting to know BlueJ

Posted by on July 21st, 2011 · Labs

Experiment with the BlueJ projects we saw in lectures.

  1. Login with your zPass login and password.
  2. Download the ‘shapes’ project zip file from here .
  3. Download the ‘picture’ project zip file from here .
  4. Unzip both files in your “My Documents” folder.
  5. In the ‘Start’ menu, select ‘Programs’ and click on BlueJ.
  6. Select ‘Open Project’ from the File menu and open the ‘shapes’ project.
  7. Experiment with constructing objects and calling methods. Try to construct a picture out of circles, squares and triangles of different sizes and colours.
  8. Use the inspector to examine the objects you have created. How do the fields on a Triangle differ from those on a Circle?
  9. Double click on the Circle class to view its source code. Try to identify the fields and methods in the code. How much of the code can you understand?
  10. Open the ‘picture’ project and have a play with the new class it provides.
  11. Open the source code for the Picture class and take a look at the draw() method. This is the code that constructs the house from shapes.
  12. Change some of the method parameters and compile the source. Can you make the sun blue? Can you change the position of the window?
  13. Optional Challenge: Add code to the draw() method to make the sun set using the slowMoveVertical() method on the Circle class.
  14. Optional Extra Challenge: If you did the above challenge you probably found that the sunset happened as soon as the draw() method was called. Try creating a separate method called sunset() that does this instead.

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.