summaryrefslogtreecommitdiff
path: root/testapp/exam/java_files/main_square.java
blob: 5cb8c35d91c8a6e7aa57796c81ba96a4087b6c79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class main_square
{
    public static <E> void check(E expect, E result)
    {
        if(result.equals(expect))
        {
            System.out.println("Correct:\nOutput expected "+expect+" and got "+result);
        }
	else
	{
	    System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result);
	    System.exit(1);
	}
    }
    public static void main(String arg[])
    {
       Test t = new Test();
       int result, input, output;
       input = 0; output = 0;
       result = t.square_num(input);
       System.out.println("Input submitted to the function: "+input);
       check(output, result);
       input = 5; output = 25;
       result = t.square_num(input);
       System.out.println("Input submitted to the function: "+input);
       check(output, result);
       input = 6; output = 36;
       result = t.square_num(input);
       System.out.println("Input submitted to the function: "+input);
       check(output, result);
    }
}