Part A. P1.4 from your textbook.

Draft: Just print


Put your work in a class AnimalGreeter.

netbrat draft | final

(What's netbrat? Try it out--paste your answer and see what happens.)

Part B. P2.4 from your textbook, but the top left corner should be (50, 50) and the side length should be 100.

Draft: Construct the square and call System.out.println(square).

netbrat draft | final

Part C. Write a program that constructs the rectangles below and computes the area of the overlap.

In order to compute the overlap, call the intersection method. In order to compute the area, call the getWidth and getHeight methods and multiply their results.

Put your work in a class Homework2C.

Draft: Construct the first rectangle and print only its area, calling getWidth and getHeight.

You must call these methods and use the values that they return in order to receive credit. For example, a submission of the form

public class Homework2C
   public static void main(String[] args)

would receive no credit.

netbrat draft | final

You submit three Java files to Canvas:

No .class files, no BlueJ .ctxt files, no zip files, no images. Just three separate Java files.

They must be the Java files that BlueJ produces. Do not paste them into Microsoft Word!

You submit the draft by Tuesday night, the final version by Sunday night.

Note that you must submit to Canvas. netbrat is anonymous and has no connection to the gradebook.