HTW Berlin Medieninformatik HTW Berlin
Fachbereich 4
Internationaler Studiengang
Internationale Medieninformatik (Bachelor)
Info 1: Informatik I
Winter Term 2022/23
Laboratory 0: Figures

This week's lab work is intended to acquaint you with the BlueJ environment. You will be working in pairs that will be assigned at the beginning of the lab. Be on time and have your Pre-Lab ready to show.

Pre-lab

What to Bring to Lab

Please bring these exercises printed out or written out with you to lab. Please have your name on your page.

P1. In the lecture we have talked about data types called int and String. Java has more predefined primitive data types. What are they? Record where you found this information.

P2. What are the types of the following values?

P3. Pick up a book—you should have at least one at home. Is it an object or a class? If it is a class, name some objects. If it is an object, name the class. Give your reasoning.

P4. What class does the following constructor belong to? How many formal parameters does it have? What are their types?

public Book (String title, double price)

If you will be using your own laptop in the lab, please install BlueJ 5.1.0 before you come to lab. Downloads are available for all platforms—it's written in Java! Write once, run anywhere!

Post-Lab, AKA  What To Turn In

Your completed assignment, submitted in Moodle as a pdf, should include:

Lab assignments are due the night before your next lab at 22.00, we want you to get some sleep the night before class. They may, of course, be turned in earlier. You hand them in by preparing the report in PDF and submitting it to the Moodle area for your group. Each member of the pair submits their own copy of the report. 


Assignment

Figures

Download the projects file from the Moodle room and open up the figures project.

  1. What do Circles, Triangles, Squares and Persons have in common? Do they have any differences?
  2. How is a Person similar to Circles, Triangles and Squares?
  3. Create a Circle, a Triangle, a Person, and two Squares. Oops, where is the second Square? How can you make both visible on the screen?
  4. Make all five figures have the same color. What did you have to do? Did you make any mistakes doing this?
  5. Now make an interesting picture using at least one of each of the shapes! Use at least seven objects. Record what you had to do to get your scene set up. Take a screenshot to include in your report.
  6. Did you make any errors? Could you delete a mistaken object? Explain how you think this worked—or didn't work. Did anything catastrophic happen? Keep records of this in your report!
  7. (For the bored) Okay, so you've been programming since before you could talk and this is child's play. Explore a little deeper—can you make the shapes canvas larger? What happens when a figure hits the wall? How can you figure out where the wall is? Right, this is badly programmed. What would you have to do to get a shape to bounce off the wall? Can you do it?

Writeup

You will be doing your writeup at home. Use the notes that you took in your logbook. Submit your writeup as your post-lab to the Moodle area.


Copyright Prof. Dr. Debora Weber-Wulff
Questions or comments: <weberwu@htw-berlin.de>
Some rights reserved. CC-BY-NC-SA - Copyright and Warranty

The exercises are adapted from Objects First with Java, A Practical Introduction Using BlueJ. David Barnes & Michael Kölling, 2016