diff options
author | prathamesh | 2013-07-08 11:22:01 +0530 |
---|---|---|
committer | prathamesh | 2013-07-08 11:22:01 +0530 |
commit | 754244da53f7e0a63c272ce6d1ffb15c1d5be0ae (patch) | |
tree | f505c0b5a1392f552580db5e30b8a33d6faccadb /testapp/java_files | |
parent | 8de499263ec00be5e500693b8db7f4b5ee0d15bd (diff) | |
download | online_test-754244da53f7e0a63c272ce6d1ffb15c1d5be0ae.tar.gz online_test-754244da53f7e0a63c272ce6d1ffb15c1d5be0ae.tar.bz2 online_test-754244da53f7e0a63c272ce6d1ffb15c1d5be0ae.zip |
Added few questions. Made changes to fix minor bugs which were found during testing.
Diffstat (limited to 'testapp/java_files')
-rw-r--r-- | testapp/java_files/main_lastDigit.java | 36 | ||||
-rw-r--r-- | testapp/java_files/main_moreThan30.java | 36 | ||||
-rw-r--r-- | testapp/java_files/main_palindrome.java | 4 |
3 files changed, 74 insertions, 2 deletions
diff --git a/testapp/java_files/main_lastDigit.java b/testapp/java_files/main_lastDigit.java new file mode 100644 index 0000000..05439e2 --- /dev/null +++ b/testapp/java_files/main_lastDigit.java @@ -0,0 +1,36 @@ +class main_lastDigit +{ + public static <E> void check(E expect, E result) + { + if(result.equals(expect)) + { + System.out.println("Correct:\nOutput expected "+expect+" and got "+result+"\n"); + } + else + { + System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result+"\n"); + System.exit(1); + } + } + public static void main(String arg[]) + { + Test t = new Test(); + boolean result; + result= t.lastDigit(12, 2, 13); + System.out.println("Input submitted to the function: 12, 2, 13"); + check(true, result); + result = t.lastDigit(11, 52, 32); + System.out.println("Input submitted to the function: 11, 52, 32"); + check(true, result); + result = t.lastDigit(6, 34, 22); + System.out.println("Input submitted to the function: 6, 34, 22"); + check(false, result); + result = t.lastDigit(6, 46, 26); + System.out.println("Input submitted to the function: 63"); + check(true, result); + result = t.lastDigit(91, 90, 92); + System.out.println("Input submitted to the function: 91"); + check(false, result); + + } +} diff --git a/testapp/java_files/main_moreThan30.java b/testapp/java_files/main_moreThan30.java new file mode 100644 index 0000000..7da31cb --- /dev/null +++ b/testapp/java_files/main_moreThan30.java @@ -0,0 +1,36 @@ +class main_moreThan30 +{ + public static <E> void check(E expect, E result) + { + if(result.equals(expect)) + { + System.out.println("Correct:\nOutput expected "+expect+" and got "+result+"\n"); + } + else + { + System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result+"\n"); + System.exit(1); + } + } + public static void main(String arg[]) + { + Test t = new Test(); + boolean result; + result= t.moreThan30(30); + System.out.println("Input submitted to the function: 30"); + check(false, result); + result = t.moreThan30(151); + System.out.println("Input submitted to the function: 151"); + check(true, result); + result = t.moreThan30(66); + System.out.println("Input submitted to the function: 66"); + check(false, result); + result = t.moreThan30(63); + System.out.println("Input submitted to the function: 63"); + check(true, result); + result = t.moreThan30(91); + System.out.println("Input submitted to the function: 91"); + check(true, result); + + } +} diff --git a/testapp/java_files/main_palindrome.java b/testapp/java_files/main_palindrome.java index bd463e5..c0745f9 100644 --- a/testapp/java_files/main_palindrome.java +++ b/testapp/java_files/main_palindrome.java @@ -4,11 +4,11 @@ class main_palindrome { if(result.equals(expect)) { - System.out.println("Correct\n:Output expected "+expect+" and got "+result); + System.out.println("Correct:\nOutput expected "+expect+" and got "+result+"\n"); } else { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result); + System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result+"\n"); System.exit(1); } } |