CSCI 51 Spring 2009

Homework 0: Hello

0%

Assigned: Tuesday, January 20
Due: Friday, January 23 through Sakai assignments.

Description

There are two parts to this assignment.  One is the creation of a text document that you will submit through sakai. 
The other part is familiarizing yourself with the Eclipse development environment by creating and executing a
HelloWorld application.


First part, to submit through Sakai:

Write a bit about yourself, including the following:

Make a text document (that's with notepad for example, not Word) addressing the above points and name the document something
informative, like hw0.txt.  Submit through Sakai under assignments.



Second part, getting started using Eclipse and programming in Java:

For this course you will need access to lab/classroom computers and for that you will need an account and access to Adams hall.

--Please send an email to me at jstough@cmc.edu with a subject heading of "CSCI 51 Building access request."
In this write your name, college, student card number, email, and phone number.

--For non-CMC students, you do not yet have a computer login and password, nor network space, so you also need to go see
Bruce Frost in the Bauer Technology Center  21 (big round building on the other side of campus from our classroom).  There you
can fill out appropriate paperwork, show your student ID, and be provided the appropriate access, which is required for class.

--If you have a home computer or laptop, and want to install Eclipse so you can work away from the lab computers, please:
       -Download and install java from  http://www.java.com/en/download/ .
       -Download and install Eclipse from http://www.eclipse.org/downloads/ or here.

--Go to a machine with Eclipse (Poppy lab or by now your personal computer).  When you first start Eclipse you will have to
supply a workspace folder.  For this folder you should create a new folder within some folder that you have available to you
from other computers.  For example you could create a new folder within your network drive (U:/Class#/... or U:/OtherSchools/..)

      -If you see a tutorial option, take it and do the Hello World application tutorial.  If not, then open a workspace or the "Java (default)" perspective.



      -From the Java workspace, select File-new-Java Project.  Name the project something "FirstProject"


       -After clicking Finish, you should see the project on your package viewer:


       -Now with the new project selected, go to File-new-Class and create a class named Hello.




       -Everything except the Name option should be filled in for you.  Disregard the warning.  After clicking Finish the new java file should be visible:


       -Make the contents of your Hello.java file the same as in the following picture. 


       -Given what you've now written you should be able to press the green run button, as shown above.  As a result "Hi." should appear in
         the Console window below your Hello.java file, as in the above.  If you haven't typed everything as above, you may have some of your
         code underlined in red.  Make sure you have copied the contents exactly.  That's your first program! 

       -In the above, Hello.java defines a class called Hello.  This is REQUIRED, that the name of the class in the file has the same name as
        the file.  Within the Hello class we have defined a main function, which the Java language looks for in your class.  The "public static..."
        line is something we will get to.  Within the subsequent curly braces is the one statement that gets executed in this program, namely
        "System.out.println("Hi.");" , which will print "Hi." to the console window as per the above picture. Change it to say something else.

       -Now open a new class (File-new-Class) called Debug. Copy the contents of Debug.java into this new file and make the manipulations
        suggested in the comment (which is not technically part of the program), which shows up as green text surrounded by /* and */ . 



       -Notice that the mistakes you make in the program show up with these underlined red errors. 

See you Tuesday.

stough