teaching machines

CS 148: Lab 4 – Methods

September 28, 2017 by . Filed under cs1, cs148, fall 2017, labs.

Welcome to lab 4!

If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab.

Our goal today is to learn more about methods, which let us extract reusable sequences of code into a separate block of code.

Checkpoint 1

Person A types. Open your Eclipse workspace and create a package named lab04.

The Java library includes a pretty fun class named Robot. With Robot, you can hijack the mouse pointer, grab screenshots, and programmatically issue keypresses. Essentially you can make your program act as a fake user, generating user input—even in other programs.

In this checkpoint, you’ll use Robot to control a drawing program. Follow these steps to get it up and running.

Checkpoint 2

Person B types.

You will design a blackbox and share it with another group. On a fun scale of 1 to 10, this will rank about a 7!