Copyright © Cay S. Horstmann 2009 
This work is licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 United States License.
See lab 1 for reporting instructions.
greeter. Make a
class Greeter (with an uppercase G). Double-click on it, erase
its contents and paste in the contents of this
file. Don't look at it—we'll have a close look in a week or so.
Just hit Compile and Close. new Greeter() from
the menu. Click Ok on the dialog. What
happens?greeter1. What two methods do you get in the middle of the
menu?sayHello. What
happens?
string1. You'll get lots of methods. Call the
length method. What does it
return?toUpperCase method. What
does it return?replaceAll method. It wants parameters. Supply two
parameters so that the method will return "Helloo Woorld!".
What parameters did you supply? (Be careful
about quotation marks.)sayGoodbye
method do?Greeter
class (tan rectangle on top), right-click and pick the new
Greeter(String) constructor call. Supply your name as the
construction parameter. Remember the quotation marks...Rectangle class of the standard library, but it is a bit
unsatisfactory that one can't actually see the rectangles. In this set of
exercises, you will work with a modification of the Rectangle
class that shows the rectangles in a window. Make a new project
rectangles. Make a class VisibleRectangle (with
uppercase V and R). Double-click on it, erase all code, and paste in this code. Don't look at the code—it
contains advanced magic that you won't understand until the end of this
semester. VisibleRectangle class and construct
a new VisibleRectangle(5, 10, 20, 30). What happens?
How did you construct the second rectangle?
translate method on the first rectangle with
parameters 100 and 50. What happens?grow method on the first rectangle with parameters
50 and 25. What happens?run method
in MyScene.java has the code
this.chair.say("Hello, World!");
this.chair.move(MoveDirection.LEFT, 1);
import statement in
MyScene.java:
import org.alice.apis.moveandturn.gallery.kitchen.Toaster;
Add these statements to the end of the run method:
Toaster fred = new Toaster(); addComponent(fred);
Run your program. What happpens?

fred.move. Watch how NetBeans gives you a list of all
move methods. This feature is called autocompletion.
Unlike BlueJ, NetBeans wants to help you. (Believe it or not, the inventors
of BlueJ don't implement this because some instructors want students to
memorize methods instead of learning more computer science.) The first one,
move(MoveDirection, Number) is the one that you want. Keep
typing fred.move(MoveDirection. and watch some choices for
move directions. FORWARD sounds good. For the number, try 5.
What happens?resize method instead.
Take a screen
capture of your supersized toaster and add it to the lab report.