CSE 115 - Fall 2008 - Banner
UB -
University at Buffalo, The State University of New York Computer Science and Engineering
  • CSE 115 - Fall 2008
CSE 115 - Fall 2008 - Navigation
CSE 115 - Fall 2008 - Lab 4

Lab 4
Last modified: September 22 2008 08:36:59 AM

- - Lab 2

Introduction

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.


Objectives

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:

  • References

There will also be a review of the following two concepts previously covered:

  • Creating objects
  • Calling methods


Lab Tasks

Becoming a better interior decorator (well, if not better than one with more creative power)

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:

  • Create a betterdecorator.Room object (either with an initial color or without)
  • Add curtains to the room you just created in a color of your choice.
  • Add at least two pieces of furniture to the room.
  • For each piece of furniture added, you should change one of its defaults by calling one of its methods. A complete list of methods you can call is available here. Probably the methods of most interest to you are ones to move the furniture (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.

Creating a transcript for submission

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.


Due dates

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.


A Note for Working at Home

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.

CSE 115 - Fall 2008 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@cse.buffalo.edu | 130 Bell Hall | (716)645-3180 x 161