I keep getting this error. I am trying to make a executive search program about the problem. I also keep getting error lines on System.out.println(); I tried other complier like programmiz. It says identifier /tmp/a9mK0HuSgu/HelloWorld.java:38: error: expected System.out.println(mincost); ^ Exception in thread "main" java.lang.Error: Unresolved compilation problem: at ExecutiveSearch.main(ExecutiveSearch.java:3) public class ExecutiveSearch {
I tried other complier like programmiz. It says identifier /tmp/a9mK0HuSgu/HelloWorld.java:38: error: expected System.out.println(mincost); ^
Exception in thread "main" java.lang.Error: Unresolved compilation problem: at ExecutiveSearch.main(ExecutiveSearch.java:3)
public class ExecutiveSearch {
public static void main(String [] args) {
int[] c1= {9,2,7,8};
int[] c2= {6,4,3,7};
int[] c3= {5,8,1,8};
int[] c4= {7,6,9,4};
int p1=0;
int p2=0;
int p3=0;
int p4=0;
int mincost=Integer.MAX_VALUE;
for(int i=0;i<4;i++) {
for(int j=0;j<4;j++) {
for (int k=0;j<4;k++) {
for(int l=0;j<4;l++) {
if(i!=j && j!=k && k!=l && i!=k && i!=l && j!=l) {
if ((c1[i]+c2[j]+c3[k]+c4[l])<=mincost) {
mincost = (c1[i]+c2[j]+c3[k]+c4[l]);
p1=i+1;
p2=j+1;
p3=k+1;
p4=l+1;
}
}
else;
continue;
}
}
}
}
}
System.out.println(mincost);
System.out.println(p1);
System.out.println(p2);
System.out.println(p3);
System.out.println(p4);
}
can you make this into a proper java code?
Step by step
Solved in 4 steps with 3 images