On this page:
Intro
1 Project Skeleton
2 Drawing Images with Java  Lib
3 A Falling Ball
6.12

Lab 6: A Simple OO Universe

Intro

You’ll work in this lab with your assigned partner. Help each other get up and running with IntelliJ and Java (Lab 4: Same Story, More Syntax). The two of you will work as a team to solve problems. At any time, one of you will be the Head and the other will be the Hands. The Head does the thinking and the Hands does the typing. Hands type only what the Head tells them to, but you’re free to discuss any issues that pop up. We’ll have you switch off during the lab to make sure each of you get practice problem solving, dealing with syntax, and getting finger exercises on the keyboard.

1 Project Skeleton

You must start this lab with this project skeleton. Unzip the file into your IdeaProjects directory and import it in IntelliJ to get started.

2 Drawing Images with JavaLib

In DrRacket, we used the library htdp/image to draw images. In Java, we’ll use JavaLib’s images. We used the library htdp/universe to draw animate our worlds. In Java, we’ll use JavaLib’s Functional Worlds.

The documentation for the images and functional world library can be found here.

These libraries are included in the project skeleton.

3 A Falling Ball

Our goal in this lab is to create a simple world with a falling ball. The ball should be initialized with a random X and Y velocity and should fall at a rate of 9.8 pixels per second. The project skeleton gives you an outline of the tasks you need to complete to get this program up and running.