Gettysburg College

CS 111
Computer Science I

Fall 2025

Assignment 2

Due: Thu, Sep 11, by 11:59pm

Description

This assignment will exercise the concept of repetition using while loops. The goal of the assignment is to create a simple Pacman app. The app will show a Pacman moving along a grid, collecting pellets along the way.

Preliminaries

Start DrJava and create a new project named PacmanApp in folder cs111/hw . See the Readings List notes on how to create a new project.

To set the whole canvas to a given color put this command as the first line in public void run():

canvas.setBackground( "desired-color" );

Requirements

Inside PacmanApp write the procedures described below. Make sure to test each procedure carefully before moving on to the next one.

Do not resize the phone/canvas by dragging the corners.

You may use fixed numbers only for:

Here are the detailed descriptions of the procedures for the app along with sample test cases:

What to turn in

Turn in the Java code for the app in the Assignment 2 dropbox:

Make sure your code is saved. If when you close DrJava it warns you that the file is not saved, save it and re-upload the code.