Assignment 0 (Due 23 Jan 2004, 5 PM)
For your first assignment, please visit the Elements Lab in
Painter Hall, room 5.38 on Friday, January 23, 2004 during the
following periods: 9 AM to Noon or 1 PM to 4 PM.
You will do the following in the lab:
- Introduce yourself to the TA and/or Proctor in Painter 5.38.
- Obtain an account: Obtain the login ID and password for your Elements
Lab account at the User Assistant's desk. No other UT account will
work in the Elements Lab. Never share your account with anyone else.
If you registered late you may not be in the system. Let the TA or
Proctor know. Give them your name so that we have a record that you
were there in the Lab. Only for this instance (not being in the system)
you may turn in your assignment late.
- Successfully login to a computer in the Elements Lab.
- If you have not already subscribed to the mailing list now is a good
time to do so. The instructions are in the syllabus and can be
accessed from the class web site at http://www.cs.utexas.edu/users/mitra.
- Start BlueJ: On the lab PC, click Start button, then select Programs,
and click on BlueJ. If you do not find it, do not hesitate to ask a
TA or proctor.
- Create a Project: Go to Project -> New Project. In the File Name field,
type your Username for the project name and click on the Create button.
The Project window will open and you will see buttons on the left that
say "NewClass", "Compile", etc. On the right, you will see a graphical
window that contains a file object icon.
- Create a Class: Click on the New Class button. A New Class dialog box
will open. Type "Hello World" in the Class Name field. Leave the class
option selected and click OK. In the graphical window, you should now
see a new object called HelloWorld. Double-click the HelloWorld object
to open it. This is going to be your HelloWorld.java file. You have
a template to work with, most of which you will modify for your purpose.
- Type in the HelloWorld program. It is not necessary that you understand
all the terms in this program. It will be explained to you in class later.
The purpose of this program is print Hello World! on the screen.
public class HelloWorld
{
public static void main ( String [] args )
{
System.out.println ( "Hello WOrld!" );
}
}
- Save your Program: Go to Class -> Save to save this file.
- Header: You need to create a header for this file. These are some
comments you put in the program to make the program more readable to
you and identifies your work to the TA. The header will be commented
out and needs to go before the main body of the program.
/*
File: HelloWorld.java
Description:
Name:
UT EID:
Course Name: CS 303E
Unique Number:
TA:
Date Created:
Date Last Modified:
*/
public class HelloWorld
{
...
}
- Once you have created your header, you can save your class again
(Class -> Save). Always save your program after any changes. This avoids
any loss of work.
- Compile: Click on the Compile button at the top of the file editing
window. If there is an error, make sure you did not make any typos
and try compiling again.
- Run your Program: Close the editing window so that you are back at the
main window. Right-click on the HelloWOrld class (yellow box labeled
HelloWorld) and select the "void main(args)" option. You will get a
pop up box. Click OK. This will run your program and show you the
output generated. If everything looks okay close the run window.
- You can find the saved file under the directory created for your project.
Since your project was named using your username, then you should be
able to find the file in the directory named by your username on the
computer's hard disk (i.e. C drive). For example, it will probably be in
C:\your_user_name. Make sure the file name that contains your Java
source code is HelloWorld.java.
- Read the instructions to the Turnin Program: This is the link to the
instructions to the
Turnin
Program http://www.cs.utexas.edu/users/mitra/turnin.html.
- Turn in your finished HelloWorld.java file according to the turnin
instructions for CS 303E. The file should contain the following things:
- The proper header
- The java source code for the HelloWorld program
Run the turnin program by going to the Windows Start menu and under
Programs chose "Turn in assignment". You will ned to submit the
HelloWorld.java file. Be sure to turn it into the correct folder - the
section in which you are offically registered.
- For fun: If you are feeling adventurous, you can introduce syntatic
errors in the code and see what the error messages are like.
- Close BlueJ: Make a backup of your HelloWorld.java file on your ZIP or
floppy disk and then logout of the computer. Always do the BEFORE
logging out, once logged out all your information is lost unless saved
elsewhere.