CS 61B  Homework 1
                       Due 5pm Friday, January 30, 2004

This homework assignment is meant to make sure you can write, compile, and run
simple Java programs.  This is an individual assignment; you may not share
code with other students.

Read Chapters 1-3 of Arnow/Dexter/Weiss.  You will need to know how to compile
and run Java programs, as described in Lab 1.

Copy the Homework 1 directory by starting from your home directory and typing
the following:
	mkdir hw1
	cd hw1
	cp $master/hw/hw1/* .

Problem 1
---------
Do Exercise 23 of Arnow/Dexter/Weiss (aka Exercise 1 of Section 3.9 of the
first edition of Arnow and Weiss) by adding to the program skeleton given in
OpenCommercial.java.

Once you have it working, modify your code so that it prints the first five
lines of the company's Web page in reverse order; i.e., the fifth, fourth,
third, second, and first lines.

To receive credit for this problem, you must follow these directions exactly:

	1) Your solution must be in a file called OpenCommercial.java .
	2) Do not edit any of the lines before the line that says 
	   "Replace this comment with your solution."
	3) Your program must print only five lines from the given home page,
           and must print them in reverse order.  Do not add any extraneous
	   println statements.  Do not modify the lines before printing them.
	   Your program must produce EXACTLY the same output as our solution,
           because we will be using an automatic grading program dumber than a
           microwave oven.

Be sure you compile your program with "javac -g OpenCommercial.java" to make
sure it compiles, and run the program using "java OpenCommercial" to ensure
that it works, before submitting it.  No partial credit will be given for
programs that don't produce a portion of a Web page.


Problem 2
---------
Write a program called "Nuke2.java" containing a class called Nuke2 whose main
method reads a string from the keyboard and prints the same string, with its
second character removed.  (That's character number 1, since Java numbers
characters in a string starting from zero.)  In other words, after you run
"java Nuke2", if you type in the string "skin", the program will print "sin".

(Note:  your program might crash with an error message if you type in a string
containing fewer than two characters.  That's okay; your program only needs to
work correctly on strings at least two characters long.)

To receive credit for this problem, you must follow these directions exactly:

        1) Your solution must be in a file called Nuke2.java, and the main
           program must be in a class called Nuke2.
        2) Your program must read just one string, then print the same string
           with the second character omitted, then exit.  Do not print anything
           else.

Again, be certain that your program compiles and runs correctly before you
submit it!  The automatic grader is not charitable.

Submitting your solution
------------------------
Warning:  the submit command probably won't work before Wednesday's class.

Clean up your hw1 directory so that it contains only the files
OpenCommercial.java and Nuke2.java .  In particular, remove all .class files
and Emacs backup files (they end with a tilde, "~") before submitting.  Change
(cd) to your hw1 directory.  Type "submit hw1".

After submitting, if you realize one of your programs is flawed, you may fix
it and submit again.  You will have to resubmit both files, even if you only
change one.  You may submit as often as you like.  Only the last version you
submit before the deadline will be graded.

If you only manage to do one of the problems before the deadline, you'll have
to create an empty file with the name of the other program so that "submit hw1"
will work.

This will be the standard procedure for submitting future homeworks and
projects as well.