CSE 115 - Spring 2010 - Banner
UB -
University at Buffalo, The State University of New York Computer Science and Engineering
  • CSE 115 - Spring 2010
CSE 115 - Spring 2010 - Navigation
CSE 115 - Spring 2010 - Announcements

Lab 2

CSE 115 - Spring 2010 - Lab 2

Introduction

In this lab, we will actually be writing some Java code that will be executed in the DrJava interactions pane.


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 two ideas that were discussed in class:

  • Creating objects
  • Calling methods
  • Using variables that hold references to objects

 


Lab Tasks

Check out the Lab2 Skeleton from the repository. You will not be editing any of the Java files in the Lab 2 skeleton, but if you are interested in how any of the code works for Lab 2, 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.

Becoming an interior decorator

There are a few things available to you in the interiordecorator package. There is a interiordecorator.Room class. This represents a room that you can decorate.

You will need to create the following objects and call the following methods to complete the lab.

  • Create a interiordecorator.Room object. You can specify a color for the room by creating a new color object in the () when you create the room
  • Call the method addCurtains, and specify a color for the curtains by creating a new color object in the () of the method call
  • Add at least two pieces of furniture to the room (Couch, Lamp, Plant, Table) by calling the add method on the room you created.
  • 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).

 


Creating a transcript for submission

You will see a file in your Lab 2 project named DrJavaInteractions.txt. Double-click to open the file in the editor. Highlight all of the text in the DrJava interactions pane and copy it. Paste it into the DrJavaInteractions.txt file where indicated. Make sure to put your name in the DrJavaInteractions.txt file where indicated. Save DrJavaInteractions.txt. BE SURE TO COPY AND PASTE YOUR WORK BEFORE YOU CLOSE THE ROOM WINDOW!

 


Attendance

You need to show your TA the results of your work on the room. If you are able to complete all of the tasks during the lab time, show the TA your finished room. If you are not, before you leave, make sure you show the TA the progress you have made on the room. Attendance will not be given for simply showing up and spending a few minutes on the lab and then leaving to do it later. Use the recitation time to complete as much of the assignment as you can (you will most likely finish it) and to be sure you understand what steps you are performing to complete the lab tasks.

 


Due dates

You will submit the project for Lab 2 using the Web-CAT Eclipse submission tool in the same way you did for Lab 1. If you do not remember how to submit, please refer back to those instructions. Your completed submission is due to be received by 11:59:59pm, Sunday, February 7th.

 


A Note for Working at Home

If you are attempting to work at home, you will need to make sure you have the image files couch.gif, lamp.gif, potted-plant.gif, and table.gif in a directory on your system named /projects/CSE115/Images where /projects is in your root directory (probably C:\ if on a Windows system). You can get the files by using a file transfer client (like Filezilla). The image files are located on the server (timberlake.cse.buffalo.edu) in a directory named /projects/CSE115/Images.

 

CSE 115 - Spring 2010 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@buffalo.edu | 130 Bell Hall | (716)645-3184