CISC370, Homework H01, Summer 2007
Getting started with Java

Due: Thursday 06/07, 11:55pm

Better: Do it TONIGHT, Tuesday 06/05, before you go to bed.

Introduction

In this assignment, you'll create a Java Program

We want to make sure that we get off to a running start, and that any problems with compiling, accounts, submitting, etc. are taken care of right away.

It will be helpful to have your HFJ textbook (Head First Java, 2nd Edition)

The Head First Java is designed to be a hands on textbook. Typically, you'll want to have an editor and compile handy where you can try things out.

But, you can do this assignment, even if you don't have the textbook. By the time we get to Homework 2 (H02), that may no longer be the case, so get your textbooks.

Required Reading

  1. H01/compilingOnStrauss.txt
  2. Head First Java, pages 1-9.

Overview

In this assignment, you will:

  1. Make sure your strauss account is configured for Java 5.0.
  2. Setup a directory structure for your labs for the course
  3. Compile a simple Java Program
  4. Script it, and submit the script on WebCT

Step 1: Configure your account for Java 5.0

You need to have your account properly configured for Java 5.0 to do the work for this course. See the following file for instructions:

H01/compilingOnStrauss.txt

Step 2: Create a simple Java Program, Compile, and Run

The steps are on p. 9 of your textbook, but in case you don't have that yet, here they are:

Step 2a: Create a Java program

Use emacs or vi to create simple "Hello World" style Java program. An example of such a program is on p. 9 of the HFJ textbook.

If you don't have the book yet, here's a link to the code.

You can also copy this directly from the file /www/htdocs/CIS/370/pconrad/07J/hwk/H01/MyFirstApp.java

Common mistakes:

Note that in Java, the name of the file must match the name of the class. Since the class in this file is called MyFirstApp , you have no choice—you must call the file MyFirstApp.java.

Step 2b: Compile it and run it.

Here's the complete sequence of command to set up a

> cd
> mkdir ~/cisc370
> cd cisc370
> mkdir H01
> cd H01
> cp /www/htdocs/CIS/370/pconrad/07J/hwk/H01/MyFirstApp.java .
> ls
MyFirstApp.java
> javac MyFirstApp.java 
> java MyFirstApp
I Rule!
The World
> 

 

Step 3: Script it

Use the script program on strauss to make a script called h01.txt (please use exactly that filename) where you

If you aren't familiar with how to script on strauss (because you took CISC105/CISC181 elsewhere, or you just need a refresher), see the following lab from the C++ intro course for help with that process. This lab also reviews some initial settings for your account that you may want to review:

Step 4: Turn it in on WebCT

Submit your work on WebCT for the assignment marked H01. Upload and submit BOTH

Yes, I want you to submit both files, even though did a cat of the MyFirstApp.java source is inside the .txt file. If you need me to explain why I require this, I will.

Next Steps: Read Chapters 2-4 in HFJ

Now read Chapters 2-4 for Thursday. As you read, you may want to apply the typo corrections from the errata to your book.

Grading: 100 points

This assignment is to your grade, almost what the "free space" is when playing Bingo. So don't blow it—get 'er done.

A word about scripting

In this assignment, I've given you some detail about what I expect in the script. I won't always do that though.

By now, you should know that the typical expectation for programming courses is this: list all your source code, show that it compiles, show that it works.

Sometimes "showing that it works" requires extra steps, including listing input files, output files, directories, etc., and running multiple times. I expect you to know that at this point in your CS education.

Due Date: (see top of file)


Valid XHTML 1.0 Valid CSS!