Lab 2 Lab 3 - part I
Introduction
Note! All classes at the university are
cancelled between 6:00PM on Wednesday and 6:00PM on Thursday, in
observance of Rosh Hashana. The traditional lab 2 and lab 3 material
has been combined into a single lab, due not next week but in two
weeks' time.
This page describes part I of the lab. There is nothing you must hand
in after doing this work, but be sure to save your work so you can
hand it in next week.
We have just begun to look at the structure of Java source code
files in class. Writing those files can be an overwhelming task for
students who are new to the task. You were just introduced to the lab
environment in Baldy 21 and you worked briefly with Eclipse to edit a
text file. In this lab, you will work a little more with Eclipse and
work with the ideas we have been explored in class about the design of
object oriented systems. You will build a simple program that uses the
ideas we have been discussing so far in class.
Objectives
The high-level objectives of this lab are to have you,
- familiarize yourself with the Eclipse environment,
- use DrJava to run a small Java program, and
- observe the behavior of an object oriented system.
The following are the new concepts covered in this lab:
- using CVS repositories,
- Eclipse environment vocabulary,
- instantiating classes using the
new operator, and
- using the DrJava plugin.
Assignment Specifications
The basic building block of an object oriented program is the
object. You have learned in class how to create an object at runtime
by instantiating a class using the new operator. In this
lab you will practice doing exactly that: creating instances of
a pre-built class.
To make things interesting, the class you will be instantiating has
some random behaviors built in. This means that something
slightly different will happen each time you instantiate it.
Helpful Hints
Read through the entire lab before you start working, so that you know
what to expect. Make sure you save your work often, and keep track of
what you are expected to submit (next week).
Do not be afraid to refer to earlier labs to recall what things
mean or what commands are available for you to use.
Reading
Make sure you have read chapter 1 of the book before coming to
lab. Also make sure you have reviewed your lecture notes. It
might also be helpful to begin looking at Chapter 1 of the Eclipse
book.
Lab set-up tasks
At your lab session your teaching assistant will briefly discuss how to carry
out each of the set-up tasks below. She or he will also be available to answer
questions you might have. Before you start work on the lab itself, you
must carry out each of the following set-up tasks. Your teaching assistant
will guide you through this process.
Step 1: Log in
The first thing you must do when you are in the lab is log in at the
SunRay in front of you. Remember that this logs you into a machine named,
styx.cse.buffalo.edu
To get access to the prompt [recall that you need the prompt to
type commands to Linux], you use the Applications menu
and select System Tools and then select
Terminal. It is probably always a good idea to open a
terminal when you log in. Recall that a terminal window looks like
this:
Step 2: Start Eclipse
The second thing you need to do is start Eclipse. In Lab 1 you
learned about the eclipse & command, and you also made
an icon for Eclipse on your desktop. Use one of them to get Eclipse
started.
Step 3: Seeing the connections to code repositories
If you do not have a tab in the lower portion of your screen that
says "CVS Repositories", you should open that View so that
you can see what Repositories you have connections to. To do this,
select Window -> Show View -> Other. You should then select
to expand the entry for CVS and select CVS Repositories and click
OK. You will now see a view tab on the bottom of your screen that
shows which repositories you have access to:
Step 4: Check out Lab project from LabSkeletons repository
Open the LabSkeletons repository (click on the "+" or triangle to the left
of its name to "spin" it open). Open "Head", and then a dialog will pop up
prompting you for your password. The password here is the same one you typed
to log into the machine in Baldy 21. Type your password in and then click
"OK".
Then the files in the Lab Skeletons Repository will be visible. Select Lab3:

Now right-click (on Lab3), and select "Check out".
In the left-most pane you will now see the Lab project in your workspace.
You should expand out the project to see what is inside it. You will notice
a package with a file named Driver.java in it.
Lab Assignment
Make an object!
Select the DrJava perspective. In the interactions
pane, create an instance of the lab3.partI.Driver class
(you may need to enlarge the window that opens up). Once you have
finished looking at what is going on, close the window. This will
cause DrJava to reset its interactions pane.
Create another instance of the lab3.partI.Driver class.
Is anything different in the behavior of the program? When you are
done, close the window.
Run the program as many times as you like.
Use the Eclipse text editor to create a text file in the Lab
project named "PartIExplanation.txt". In that file describe in your
own words what the program does. Save the file for next week.
Meet your Mentor (CSE 503 students are exempt from this part of the lab)
The non-coding portion of this lab is to attend the first meeting
that your mentor is having. The mentors have collected your
schedules and will be finding a meeting time that works for them as
well as (most of) the people that sent him/her e-mail. As the
mentors schedule times, we will post them here:
| Mentor | Meeting time | Meeting place |
| Amy Evans | T 2-3, R 5-6 | Student Union lobby |
| Jacob Joyce | M 3-4, T 6-7 | Outside Bell 101 |
| Jonathan Cantwell | W 5-6 | Flag room in student union |
| Kyle Carbone | T 4-5, M 3-4 | Capen Group Study area (basement) |
| Matthew Taylor | M 2-3, F 2-3 | Bottom floor of Capen library, by tables |
| Michael Hausknecht | R 8-9 | Baldy 121 |
| Ka Kei (Michael) Iao | T 5-6, F 10-11 | Capen Cafe |
| Nischal Vasant | T 5-6 | Student Union lobby (between Putnams and the UB seal) |
| Rajitha Jayasinghe | | |
| Rishi Sharma | F 4-6 | Capen Group Study area (basement) |
| Russell Manzella | W 5-6 | Flag room in student union |
| Stephen Fey | T 2-3, R 5-6 | Student Union lobby |
| Tushar Saxena | T 6-7 | Capen Group Study area (basement) |
| Zeb Lohnes | M 1-2, M 3-4 | Baldy 21, Baldy lounge by Kiva |
You should go to the meeting and find out what mentoring is all
about and what kinds of information you can share as a group. Your
mentor will record your attendance at this meeting and your
attendance will be a portion of the lab grade for this lab.
Your mentor will be in touch via e-mail or through the course
website. If you are having difficulty attending one of the mentor
meetings from your recitation, please note the schedules of other
mentor meetings. You can attend another mentor's meeting to gain
credit for this portion of the lab. If you are having difficulties
with this part of the assignment, please contact your
instructor.
Note: The first meeting may actually occur after this lab is due
for you. You are still required to turn in the coding portion on
time. You should then attend the meeting at its scheduled time.
What you hand in
As explained in the note at the start of the lab, there is nothing
for you to hand in this week.
Due dates
As explained in the note at the start of the lab, there is nothing
for you to hand in this week.