We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 80aa6a7 commit 93adef9Copy full SHA for 93adef9
1 file changed
src/sumDouble.java
@@ -0,0 +1,22 @@
1
+/*sumDouble
2
+ * Given two int values, return their sum. Unless the two values are the same, then return double their sum.
3
+ * sumDouble(1, 2) → 3
4
+ * sumDouble(3, 2) → 5
5
+ * sumDouble(2, 2) → 8
6
+ */
7
+public class sumDouble {
8
+
9
+ //Class for testing and setting dummy values
10
+ public static void main(String [] args ) {
11
+ int a = 2;
12
+ int b= 2;
13
14
+ //Output tests
15
+ System.out.println( sumDouble(a, b) );
16
+ }
17
+ public static int sumDouble(int a, int b) {
18
+ int result = (a == b) ? (2*(a+b)) : (a + b);
19
+ return result;
20
21
+}
22
0 commit comments