Tuesday, November 25, 2014

ASSIGNMENT #1



ASSIGNMENT #1
===========



    The purpose of this assignment is to familiarize you with Eclipse.
   First you must start Eclipse. Click on the Eclipse shortcut If there is
 no such shortcut, click on start, select Programs and then click on
  Eclipse. Once in Eclipse, go to the tool bar on top and click on File. A menu opens up and you click on New Java Project.



Now you have the Name and Location icon. In the project name slot type “JAVAASSIGNMENT1”
The number is 1 for the first, and keeps going up as you create more projects. Make sure use default location is checked-marked.

Next click the Finish button.

  Now you have to add Class file to the Project. Right click the JavaApplication1 project and New->Class

You will see this window.





under package name enter (without quotes)

“com.intro.java”


enter name (without quotes)

“JavaAssignment1”
make sure you check mark which stubs – public static void main(String[] args)

then click Finish

you will then see the following:

package com.intro.java;

public class JavaAssignment1 {

     /**
      * @param args
      */
     public static void main(String[] args) {
           // TODO Auto-generated method stub

     }

}


Add the following comment block to the top of the file above package.

/* Course      : Intro to Java Programming
 * Instructor  : Tavaris Thomas
 * Author      :  (your name)
 * Assignment #: 1
 * Due date    : April 23 2012
 * Description : Type, compile, and run a canned Java program
 *
 */

Add your name to the author section

After that, write the statement below immediately after the TODO ... comment.

    System.out.println("Welcome to Java!");









You should have the file below.

/* Course      : Intro to Java Programming
 * Instructor  : Joseph
 * Author      :  (your name)
 * Assignment #: 1
 * Due date    : April 23 2012
 * Description : Type, compile, and run a canned Java program
 *
 */

package com.intro.java;

public class JavaAssignment1

     /**
      * @param args
      */
     public static void main(String[] args) {
           // TODO Auto-generated method stub
            System.out.println("Welcome to Java!");
     }

}
   Now you are ready to run your program.
Go to the top tool bar and click on Run.  (green circle with white arrow)
Welcome to Java!

  If the compilation is unsuccessful, the file console displays
the syntax errors. When this occurs, look at what you typed and compare it
with the file above.
Assume that I typed System.out.println("Welcome to Java!") and I forgot
the semicolon
Then that line will have a red underline and an ! sign will be placed in front
of it. This is a signal that there is a syntax error.

When your program runs successfully you can email it to me for grading.



No comments:

Post a Comment