Overview

This assignment introduces the Eclipse Integrated Development Environment and a basic Java program.

 

LEGEND: Keyboard    Screen

Task 1: Create a new Eclipse Java project titled Chapter1

  1. File | All Programs | Computer Classes | Eclipse 3.3
    • You will likely be asked to define a "Workspace" -- which is simply a place to store your files and settings. Use the eclipse directory you created in Lab 0, which should be at k:\cosc181\eclipse\
  2. File | New | Java Project
    • Type Chapter1 as the Project Name
    • click Finish

Task 2: Create a Java main class titled HelloWorld within project Chapter1

  1. Highlight Chapter1 in the Project Explorer along the left
  2. File | New | Class
    • Make sure Source folder is Chapter1/src
    • For Name type HelloWorld (just like that -- no space, uppercase 'H' and 'W')
    • check the box next to public static void main(String[] args)
    • click Finish

Task 3: Add code to HelloWorld to make it display "Hello World!"

  1. Place the cursor at the end of the line that reads //TODO Auto-generated method stub
  2. Hit Return, then type System.out.println("Hello World!");
  3. File | Save
  4. Run | Run
    • Along the bottom, you should see a "Console" tab with the output "Hello World!"

Task 4: Add a standard class header comment to HelloWorld.java

  1. Copy and paste the following lines before the line that starts public class HelloWorld {
  2. /**
    * HelloWorld displays a generic message to the console.
    *
    * @author Gene Rohrbaugh
    * @version 1.0 8/29/2009
    *
    */
  3. Change the author to your name and the date to today's date

Task 5: Take a screen shot of a successful run of your program

  1. Run the program ( Run | Run ), then take a screenshot of the Eclipse window ( Alt-PrntScrn ) , then save it as k:\cosc181\lab\lab11_lastname\HelloWorld.jpg

Task 6: Copy your java source file into the submission directory

  1. go to k:\cosc181\eclipse\Chapter1\src\

  2. right click on the Java source file HelloWorld.java and select Copy (alternatively, you could select the file and type ctrl+c to copy)

  3. go to k:\cosc181\labs\lab01_lastname and paste ( Right-click | Paste or Edit | Paste )

  4. The directory should now contain two files: HelloWorld.jpg and HelloWorld.java.

Task 7: Prepare and submit your lab

  1. Virus-scan the folder containing your files ( lab11_lastname )
  2. Compress the folder to a zip file named lab11_lastname.zip
  3. Upload the zipped directory to Sakai
  4. Submit the assignment

 

Challenge Problem

  1. Based on your HelloWorld program, make a program that displays a custom message, such as:

    Hello Gene!
    You are an awesome Java programmer!
  2. Your program should be named HelloName, where Name is your own name.
  3. Make sure you change the header comment to reflect the new purpose.
  4. Submit a single, zipped, virus-checked folder containing a screenshot of a successful run (HelloName.jpg) and a copy of the HelloName.java source file.
Copyright © 1999-2008| Gene Rohrbaugh | Privacy Statement