hi,
when I run code I get correct answers and meet all task criterias, except last one
last one says:
"The min(a, b, c, d) method must return the minimum of the numbers a, b, c, and d."
and so it does!
what is wrong here?
package com.codegym.task.task02.task0217;
/*
Minimum of four numbers
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
int min1 = min(a,b);
if (min1 == a && a <= c && a <= d){
return a;
}else if (min1 == b && b <= c && a <= d){
return b;
}else if (c <= a && b <= b && a <= d){
return c;
}else {
return d;
}
}
public static int min(int a, int b) {
if (a > b){
return b;
}else{
return a;
}
}
public static void main(String[] args) throws Exception {
System.out.println(min(-20, -10));
System.out.println(min(-20, -10, -30, -40));
System.out.println(min(-20, -10, -30, 40));
System.out.println(min(-40, -10, -30, 40));
}
}