Cal State L.A. logo and University Seal - Link back to main page

CIS 283 - Programing assignment00

Email: jperezc at calstatela.edu

 

For this assignment you are going to write your first Java program called:

- MyFirstClass

The purpose of this assignment is to learn to write the simplest program, compile it and test it.

What follows is a quick summary of what you will have to do. Each step is clearly defined later.

Summary:

You must create a file called MyFirstClass.java using a text editor. Then download the file Test.class to the same folder. After you compile all your classes as described below, along with the Test class, you will type the command:

java Test

The result of the previous command is that the class Test will run a series of tests on your code. At the end of the tests the program will tell you which option to enter for programmingAssignment00 in moodle.

The test class will also print several messages telling you which tests were passed by your code and which did not. It may also give you hints about what you need to do in order to pass the remaining tests. You can run the tests as many times as you like and continue to refine your code until you are satisfied with the results (i.e. your code passes all the tests successfully). But submit your results only once.

You must also upload in moodle the file MyFirstClass.java.

Here are the steps you have to follow in order to complete this assignment:

    1. create a file called MyFirstClass.java using a text editor (notepad, for example, if you are using Windows).
    2. save file MyFirstClass.java in a folder called Assignment00
    3. the file MyFirstClass.java must contain the following:
    4. class MyFirstClass {

      }

    5. download file Test.class from:
    6. http://www.calstatela.edu/faculty/jperezc/courses/CIS283/programming_assignments/ProgrammingAssigment00/Test.class.zip

      (you can download the file by right-clicking on the link above)

      in case you are using an older version of Java try this: Test6

    7. save Test.class in folder Assignment00
    8. open the DOS prompt window
    9. change directories to directory Assignment00
    10. the DOS command to change directories is cd

    11. in order to compile your program type:

      javac MyFirstClass.java

      if your file compiles without problems you now should have a file called MyFirstClass.class in your Assignment00 directory

    1. after the file compiles without errors, type:

      java Test

      tests will be run on your code and appropriate messages will be printed out showing which tests passed and which failed. At the end the program will tell you which option to enter as the correct answer in the corresponding quizz in moodle.

    1. enter the correct answer in moodle, and submit. You can submit only once and only during class time or else it will not count as lab work.