The code below compares three numbers and it prints out the Maximum and Minimum value, let me hope it will rescue somebody :)
import java.util.Scanner;
public class MaxMin
{
public static void main(String args[])
{
int w,x, y;
System.out.println("\n\nTHE PROGRAM BELOW CALCULATES AND OUT PUTS THE MAXIMUM AND MINIMUM OF THREE DIFFERENT MARKS OBTAINED");
System.out.println("\n\nTHE PROGRAM HAS BEEN PRODUCED FOR THE JAVA ASSIGNMENT GIVEN BY MR GOLOOBA RONALD");
System.out.println("\n***********************************************************************");
System.out.println("\n Enter Your first value: ");
Scanner in = new Scanner(System.in);
w = in.nextInt();
System.out.println("\nEnter Your second value: ");
x = in.nextInt();
System.out.println("\nEnter Your third value: ");
y = in.nextInt();
if (w>x && w>y) {
System.out.println("\n The maximum Value is :"+w);
}
else if(x>w && x>y){
System.out.println("\n The maximum Value is :"+x);
}
else if(y>w && y>x){
System.out.println("\nThe maximum Value is :"+y);
}
else{
System.out.println("\nThe minimum Value is :"+y);
}
if (w<x && w<y) {
System.out.println("\n The minimum Value is :"+w);
}
else if(x<w && x<y){
System.out.println("\n The minimum Value is :"+x);
}
else if(y<w && y<x){
System.out.println("\nThe minimum Value is :"+y);
}
else{
System.out.println("\nThe minimum Value is :"+y);
}
System.out.println("\n************************************************************************");
System.out.println("\n\nRegards from Mukiibi Ismail");
System.out.println("\n************************************************************************");
}
}