Homework A

Homework A

1. Go to File->New Module... and choose a create a new Java Module. Set the module name to "Java Primer I" and put it in a directory named
"java1" under your root project directory (e.g.: C:\compmodels\java1)
and tell IDEA to create the directory if it doesn't already exist.

2. Tell IDEA to put the source file in the src directory (default) and the
compiler output path to the classes directory (default).

3. In the Project view, and under Java Primer I->java1->src, right-click
on src and select New->Class. Give it the name TwoPlusTwo and input
the following code:

public class TwoPlusTwo {
    public static void main(String args[]) {
        int a = 2;
        int b = 2;
        int c;
        c = a + b;
        System.out.println("Two plus two is " +c);
    }
}

4. To execute your program, righ-click on TwoPlusTwo and select "Run
TwoPlusTwo.main()" and you should get the following ouptut:

Two plus two is 4

5. Continue similarly with step 3 and 4 for the remaining exercises.