Computer Science 252
Problem Solving with Java

Fall 2015, The College of Saint Rose

Lab 6: Irate Ibises
Due: 11:59 PM, Friday, October 2, 2015

This week's task is to gain some experience with custom classes.

You may work alone or with a partner on this lab. Only one submission per group is needed.

Getting Set Up

Working solutions to all programs can be downloaded here.

Before you do any coding, download the a starter project with partial implementations of some of the programs from here.

Practice

First, you'll practice a technique similar to one you'll need in the programming assignment: making an object grow taller.

Practice Program: Write a program GrowingRectangle.java that creates a 50 ×10 black rectangle at (100, 300) when it starts. Each time the mouse is moved inside the rectangle, it grows upward by 5 units (i.e., it gets taller). When it reaches a height of 250, it turns red and stops growing. (8 points)

A few notes on this one:

Irate Ibises

Your programming assignment is to complete a program that draws some birds (we'll think of them as ibises, since they're going to be tall birds, hence the name "irate ibises", which I hear is the next hit app from Rovio).

The canvas initially starts empty. When you press the mouse on the canvas, an ibis starts growing at that point. Initially it will be just a short bird with a body, beak, and legs. The bird's body may be of a color of your choosing. The base of the bird's body should be at the press point. As you drag the mouse around, it grows taller. When it reaches its full height, the bird stops growing and eyes appear. The ibis won't grow any more, but if you press on its eyes after the bird has reached full size, its body should change to a new randomly generated color. When you are happy with the ibis's color, you can grow another one by pressing somewhere else in the window.

Your program should be divided into two classes: a window controller called IrateIbises and an Ibis class. The starter folder provides a complete IrateIbises class, which you should not modify. Your task is to complete the partially-implemented Ibis class so that it works with the provided IrateIbises. In particular, the Ibis constructor takes two parameters: the Location of the bottom of the bird's body and the canvas, and draws the initial ibis. You are welcome to use this code or replace it with one of your own design. The Ibis class defines "stubs" for the following methods which are used by the controller to implement the functionality described above:

Submitting

Before 11:59 PM, Friday, October 2, 2015, submit your lab for grading. There are three things you need to do to complete the submission: (i) Copy your file with the answers to the lab questions into your project directory. Be sure to use the correct file name. If you prepared your answers in Word, export to a PDF file and submit that. (ii) Email a .7z or .zip file containing your project directory to terescoj AT strose.edu. (iii) Demonstrate the execution of your programs for your instructor. (2 business day grace period for demos).

Grading

This assignment is worth 45 points, which are distributed as follows:

> FeatureValueScore
Practice Program
GrowingRectangle initial creation 1
GrowingRectangle rectangle grows upward on move 5
GrowingRectangle rectangle stops growing and turns red 4
IrateIbises Correctness
Ibis grows while mouse is dragged 7
Growth stops at specific height 5
Eyes appear when height is achieved 7
Color changes when most recent ibis's eyes clicked 4
Color changes only when growth is complete and eyes are visible 3
Style, Design, and Efficiency
Appropriate comments 4
Good variable names 2
Appropriate variable declarations 2
Appropriate formatting 1
Total 45