summaryrefslogtreecommitdiff
path: root/yaksh/java_files
diff options
context:
space:
mode:
authorankitjavalkar2015-09-14 12:28:41 +0530
committerankitjavalkar2015-09-15 11:33:59 +0530
commit7a60f782995eed0352f3172f445bb35ae8ee6aa9 (patch)
tree91d6d12b0a494dd9777fd1120e92db5763bf009a /yaksh/java_files
parent32cde26f9807a29eb1fae0833e353212d43d7802 (diff)
downloadonline_test-7a60f782995eed0352f3172f445bb35ae8ee6aa9.tar.gz
online_test-7a60f782995eed0352f3172f445bb35ae8ee6aa9.tar.bz2
online_test-7a60f782995eed0352f3172f445bb35ae8ee6aa9.zip
Remove testapp dir, remove reference to testapp in paths, files
Diffstat (limited to 'yaksh/java_files')
-rw-r--r--yaksh/java_files/main_array_sum.java36
-rw-r--r--yaksh/java_files/main_fact.java29
-rw-r--r--yaksh/java_files/main_great.java39
-rw-r--r--yaksh/java_files/main_hello_name.java29
-rw-r--r--yaksh/java_files/main_lastDigit.java36
-rw-r--r--yaksh/java_files/main_moreThan30.java36
-rw-r--r--yaksh/java_files/main_palindrome.java29
-rw-r--r--yaksh/java_files/main_square.java32
8 files changed, 266 insertions, 0 deletions
diff --git a/yaksh/java_files/main_array_sum.java b/yaksh/java_files/main_array_sum.java
new file mode 100644
index 0000000..5eae299
--- /dev/null
+++ b/yaksh/java_files/main_array_sum.java
@@ -0,0 +1,36 @@
+class main_array_sum
+{
+ 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[])
+ {
+ int result;
+ Test t = new Test();
+ int x[] = {0,0,0,0,0};
+ result = t.array_sum(x);
+ System.out.println("Input submitted to the function: {0,0,0,0,0}");
+ check(0, result);
+ int a[] = {1,2,3,4,5};
+ result = t.array_sum(a);
+ System.out.println("Input submitted to the function: {1,2,3,4,5}");
+ check(15, result);
+ int b[] = {1,2,3,0,0};
+ result = t.array_sum(b);
+ System.out.println("Input submitted to the function: {1,2,3,0,0}");
+ check(6, result);
+ int c[] = {1,1,1,1,1};
+ result = t.array_sum(c);
+ System.out.println("Input submitted to the function: {1,1,1,1,1}");
+ check(5, result);
+ }
+}
diff --git a/yaksh/java_files/main_fact.java b/yaksh/java_files/main_fact.java
new file mode 100644
index 0000000..325dab6
--- /dev/null
+++ b/yaksh/java_files/main_fact.java
@@ -0,0 +1,29 @@
+class main_fact
+{
+ 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.factorial(0);
+ System.out.println("Input submitted to the function: 0");
+ check(1, result);
+ result = t.factorial(3);
+ System.out.println("Input submitted to the function: 3");
+ check(6, result);
+ result = t.factorial(4);
+ System.out.println("Input submitted to the function: 4");
+ check(24, result);
+ }
+}
diff --git a/yaksh/java_files/main_great.java b/yaksh/java_files/main_great.java
new file mode 100644
index 0000000..4bfcb1f
--- /dev/null
+++ b/yaksh/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);
+
+ }
+}
diff --git a/yaksh/java_files/main_hello_name.java b/yaksh/java_files/main_hello_name.java
new file mode 100644
index 0000000..84bb282
--- /dev/null
+++ b/yaksh/java_files/main_hello_name.java
@@ -0,0 +1,29 @@
+class main_hello_name
+{
+ 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();
+ String result;
+ result = t.hello_name("Raj");
+ System.out.println("Input submitted to the function: 'Raj'");
+ check("hello Raj", result);
+ result = t.hello_name("Pratham");
+ System.out.println("Input submitted to the function: 'Pratham'");
+ check("hello Pratham", result);
+ result = t.hello_name("Ram");
+ System.out.println("Input submitted to the function: 'Ram'");
+ check("hello Ram", result);
+ }
+}
diff --git a/yaksh/java_files/main_lastDigit.java b/yaksh/java_files/main_lastDigit.java
new file mode 100644
index 0000000..05439e2
--- /dev/null
+++ b/yaksh/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/yaksh/java_files/main_moreThan30.java b/yaksh/java_files/main_moreThan30.java
new file mode 100644
index 0000000..7da31cb
--- /dev/null
+++ b/yaksh/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/yaksh/java_files/main_palindrome.java b/yaksh/java_files/main_palindrome.java
new file mode 100644
index 0000000..c0745f9
--- /dev/null
+++ b/yaksh/java_files/main_palindrome.java
@@ -0,0 +1,29 @@
+class main_palindrome
+{
+ 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.palindrome(123);
+ System.out.println("Input submitted to the function: 123");
+ check(false, result);
+ result = t.palindrome(151);
+ System.out.println("Input submitted to the function: 151");
+ check(true, result);
+ result = t.palindrome(23432);
+ System.out.println("Input submitted to the function: 23432");
+ check(true, result);
+ }
+}
diff --git a/yaksh/java_files/main_square.java b/yaksh/java_files/main_square.java
new file mode 100644
index 0000000..5cb8c35
--- /dev/null
+++ b/yaksh/java_files/main_square.java
@@ -0,0 +1,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);
+ }
+}