In this lab, we will actually be writing some Java code that will be executed in the DrJava interactions pane. This will be the last week that we will be working exclusively in the DrJava interactions pane. Next time, we'll be writing our own class definitions and using them in our own programs.
You will be interacting with the DrJava interactions pane and executing some Java code that you will write. We will concentrate on the following idea that was discussed in class:
There will also be a review of the following two concepts previously covered:
Check out the Lab4 Skeleton from the repository. You will not be editing any of the files in the Lab 4 skeleton, but if you are interested in how any of the code works for Lab 4, you are more than welcome to look at the code that you check out from the skeleton. You will type all the code for this assignment into the DrJava interactions pane and observe the results. You will be submitting a transcript of what you typed into the interactions pane as described below.
This time, the room retains all of the original functionality with regard to the curtains and colors for the curtains, but this time, you can add various components to the room (well, pieces of furniture really) and then you can manipulate them in various ways.
For successful completion of the lab assignment, you will need to do the following:
betterdecorator.Room
object (either with an initial color or without)
curtains to the room you just created in a color of your choice.setLocation
), change its size (setDimension
), or for some really funky rooms: change its rotation (setRotation
) or set a behavior (setMovement
). Note that the last one involves that you also create a behavior.When you have completed your room, have the TA come over and see your work so that you can receive attendance credit for this lab.
Once again you should create a transcript for your submission by first creating a brand new Java Project named Lab4Submission
and importing the Lab4Submission.jar
file located in /projects/CSE115/Repositories/Fall2008
. There will once again be a file named interactions.txt
where you should paste the entirety of your DrJava interactions session. Make sure to save the file.
Export the Lab4Submission
project as you did in the previous lab. Submit the Lab4Submission.jar
file using the electronic submission command.
Some of the lab is due in lab time and there are other parts that you must submit. The Lab4Submission.jar
must be submitted using the electronic submission command by the end of the upcoming weekend, so by 11:59:59pm, Sunday, September 28th.
If you are attempting to work at home, you will need to make sure you have a file named Classlibs.jar
in a directory named /projects/CSE115/Classlibs/Fall2008
where /projects
is a directory in your root directory (probably C:\
if on a Windows system). You will also need to make sure that you have a the image files for the couch, plant, lamp, and table in this same directory. Both can be transferred using a file transfer client. They are located in the same directory on our server as the one that you need to set up on your machine.
Images from http://free-clipart.net/, http://www.webweaver.nu/, and http://classroomclipart.com
Lab authored by Adrienne Decker
Page maintained by Adrienne Decker
Contact: adrienne@cse.buffalo.edu | 130 Bell Hall | (716)645-3180 x 161