Assignment 0: Set Up and First Java Programs

Objectives:

Due: Before the next class (Wednesday).

Setting Up Your Account

Create a directory for cs209 and a subdirectory for assign0 within the cs209 directory.

Part 1: Your First Program

In jEdit, create a Java class called Intro in a file named Intro.java. The Intro class's main method should print out, on separate lines, your name, your favorite color, and your favorite pop culture character. For example:

Sara Sprenkle
Favorite Color: Purple
Favorite Pop Culture Character: Snookie

All the top-down design principles from CS111 and CS112 apply in any computer science course. Do not try to write the entire program in one go. Break the problem into manageable pieces.

You should write only a little code at a time, then compile and execute it (see directions below) so that you find bugs quickly. You're just getting used to the new Java syntax, so I'm sure you'll run into problems. If you run into problems, compare your code to the examples from class.

Make sure your program is well-documented, as discussed in class.

Compiling the Program

In a terminal, from the directory that contains Intro.java, compile your program using javac Intro.java

If there are errors, fix those errors and re-compile until it works.

Executing the Program

In a terminal, from the directory that contains Intro.java, execute your program using the command
java Intro

If the output is not what you expect, edit your program, recompile and execute.

When you're sure your program is working correctly, execute your program using the command
java Intro > output, which writes the output from java Intro into the file output.

Part 2: Fixing A Program

Objective: The goal of this part of the assignment is to get you familiar with the required Java syntax, the compiler's error messages, and how to fix the errors so that the program compiles.

Save Assign0.java into your assign0 directory.

This program contains at least 5 errors. Some are compiler errors that the compiler will catch. Others are logic errors that the compiler won't catch.

Comment out the original code and note the cause of the error. Then, correct the code.

Saving the Final Output

After you're sure the program works correctly, save the output in a file called debugged.out as you did in the last problem.

Turning in Your Assignment

Copy your assign0 directory into your turnin directory, i.e., /home/courses/cs209/turnin/yourusername

For example: cp -r assign0 /home/courses/cs209/turnin/sprenkles/

There is no printed part of this assignment.

Grading (80 pts)

You will be evaluated based on

Part 1 (20 pts)

Part 2 (40 pts)

Style/Indentation (10 pts)

Turnin (10 pts)