summaryrefslogtreecommitdiff
path: root/testapp/exam/java_files/main_great.java
diff options
context:
space:
mode:
authorankitjavalkar2015-04-23 19:32:37 +0530
committerankitjavalkar2015-04-26 19:46:01 +0530
commit17752a69114e7dbad266337e768013920aec8c0c (patch)
tree7f88fe72bda2dfca49e0032888fb0cb01cc73d1a /testapp/exam/java_files/main_great.java
parent0580f99fecc0bb495beb5706e18246834174710b (diff)
downloadonline_test-17752a69114e7dbad266337e768013920aec8c0c.tar.gz
online_test-17752a69114e7dbad266337e768013920aec8c0c.tar.bz2
online_test-17752a69114e7dbad266337e768013920aec8c0c.zip
Code Review: Code refactoring
- Add from_json classmethod - Question language is passed directly to the code server - Fix errors in evaluation of code - Fix test cases
Diffstat (limited to 'testapp/exam/java_files/main_great.java')
-rw-r--r--testapp/exam/java_files/main_great.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/testapp/exam/java_files/main_great.java b/testapp/exam/java_files/main_great.java
new file mode 100644
index 0000000..4bfcb1f
--- /dev/null
+++ b/testapp/exam/java_files/main_great.java
@@ -0,0 +1,39 @@
+class main_great
+{
+ 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;
+ result = t.greatest(1, 3, 4);
+ System.out.println("Input submitted to the function: 1, 3, 4");
+ check(4, result);
+ result = t.greatest(5, 10, 3);
+ System.out.println("Input submitted to the function: 5, 10, 3");
+ check(10, result);
+ result = t.greatest(6, 1, 4);
+ System.out.println("Input submitted to the function: 6, 1, 4");
+ check(6, result);
+ result = t.greatest(6, 11, 14);
+ System.out.println("Input submitted to the function: 6, 11, 14");
+ check(14, result);
+ result = t.greatest(3, 31, 4);
+ System.out.println("Input submitted to the function: 3, 31, 4");
+ check(31, result);
+ result = t.greatest(26, 13, 3);
+ System.out.println("Input submitted to the function: 26, 13, 3");
+ check(26, result);
+
+ }
+}