CS1007
Fall 2002
Homework #1
due Tue Sep 17, by 6AM (electronically)

goal.
The goal of this assignment is to make sure that you know how to perform the basic operations in the programming environment which you will be using for the rest of the semester:

  1. creating/editing a program,
  2. compiling and running your program, and
  3. submitting your program, electronically (by 6AM) and in hardcopy form (bring to class on Tue Sep 17).

As well, the goal of this assignment is to learn how to WRITE and READ instructions carefully.

This assignment is worth 5 points (out of 100 the semester). Distribution of points is indicated below.

1. create/edit.
Create a program that outputs to the computer screen a set of directions for changing a lightbulb inside a light fixture (i.e., some kind of lamp).

Your program should be a Java application.

Use the formatting tips discussed in class so that your output is easy to read (0.5 points).
Your output should have two sections, and each must be clearly labeled (0.5 points):
(1) parts
(2) instructions

Each instruction must be numbered (0.5 points).
Each instruction must be described simply and should contain only one thing to do (0.5 points).
The parts list must be complete and described clearly (0.5 points).
Be creative about what kind of lightbulb you use and what kind of light fixture you are changing the lightbulb in (but not overly complicated) -- the total output should not be longer than 20 numbered instructions --> -- (0.5 points).

A Java program consists of objects (parts) and actions (instructions), and each action must be described clearly and simply -- so keep this in mind when you create your set of directions.

Here's an example for changing the batteries in a flashlight:
Directions for Changing the Batteries in a Flashlight
-----------------------------------------------------

Parts
-----
2 new size D batteries
1 flashlight

Instructions
------------
1. Lay the flashlight down on a flat surface that is easy for you to
reach, such as a table.
2. Rotate the flashlight so that it is lengthwise horizontally in
front of you, with the top end near your right hand and the bottom end
near your left hand.
3. Place your right hand on the flashlight near the top and your left
hand on the flashlight near the middle of the flashlight.
4. Firmly grip the flashlight with both hands and gently rotate your
two hands in opposite directions from each other, so that the top of
the flashlight unscrews from the rest of the flashlight.
5. Place the top of the flashlight on the table and release it.
6. Lift the flashlight with your left hand and turn it upside down so
that the old batteries inside it fall out onto the table.
7. Still holding the flashlight with your left hand, turn it right
side up. 
8. Take one new battery with your right hand and hold it lengthwise
vertically, with the positive terminal facing up.
9. Insert that new battery inside the now empty shaft of the
flashlight, still holding the flashlight with your left hand and
releasing the battery from your right hand so that the battery drops
to the bottom of the shaft.
10. Take the second new battery with your right hand and hold it
lengthwise vertically, with the positive terminal facing up.
11. Insert that new battery inside the shaft of the flashlight, still
holding the flashlight with your left hand and releasing the battery
from your right hand so that the battery drops to the bottom of the
shaft.
12. Still holding the flashlight with your left hand, pick up the top
of the flashlight from the table with your right hand.
13. Rotate the top of the flashlight so that its screw threads align
with the screw threads on the inside of the shaft in the body of the
flashlight.
14. Lower the top on to the shaft and gently screw the top onto the
body of the flashlight by rotating your two hands in opposite
directions.
15. Done.

Name your file properly!!! (0.5 points).
Your program file MUST be named hw1<yourCUNIXusername>.java
For example, mine would be called hw1eis2003.java.
BE SURE TO NAME YOUR FILE USING ALL lower case LETTERS!!!

2. compile and run.
Compile and run the program. If it doesn't compile or run properly, then check that you have typed in the code exactly as above and that you have followed the instructions for these steps exactly as described in class.

3. submit.
You need to submit your program in two ways: electronically and hard copy. This process will be the same for all homework assignments for this course, so master it NOW.

  1. electronically(0.5 points).
    Follow instructions on the assignments page.
  2. hardcopy.
    (1) Print out the homework template cover page (http://www.columbia.edu/~cs1007/hw-template.html) and fill it out (0.5 points).
    STAPLE the cover page to a hardcopy (print-out) of your program (the Java source code, e.g., the file named hw1eis2003.java) (0.5 points).
    Make sure your name is on all the papers you hand in!
    (2) Bring the cover page and hardcopy to class on the day the assignment is dueand deposit it in the homework box at the front of the classroom within the first 5 minutes of the class (by 2.45pm).