Good day to every one.
First here is my code so far
import java.io.*;
public class Program2 {
public static void main (String[]args) throws IOException{
BufferedReader bv = new
BufferedReader (new InputStreamReader(System.in));
String a, b, c, x;
Float d, e, f, g, h, i, j, k, l, m, ave;
System.out.println("ENTER FIRSTNAME: ");
a = bv.readLine();
System.out.println("ENTER LASTNAME: ");
b = bv.readLine();
System.out.println("ENTER COURSE: ");
c = bv.readLine();
System.out.println("------ GRADE -------");
System.out.println("SUBJECT1 : ");
x = bv.readLine();
d = Float.parseFloat(x);
System.out.println("SUBJECT2 : ");
x = bv.readLine();
e = Float.parseFloat(x);
System.out.println("SUBJECT3 : ");
x = bv.readLine();
f = Float.parseFloat(x);
System.out.println("SUBJECT4 : ");
x = bv.readLine();
g = Float.parseFloat(x);
ave = (d+e+f+g)/4;
System.out.println("Your Average is: "+ave);
if(d>e&&d>f&&d>g){
System.out.println("HIGHEST : "+d);
}
else if (e>d&&e>f&&e>g){
System.out.println("HIGHEST : "+e);
}
else if (f>d&&f>e&&f>g){
System.out.println("HIGHEST : "+f);
}
else if (g>d&&g>e&&g>f){
System.out.println("HIGHEST : "+g);
}
if(d<e&&d<f&&d<g){
System.out.println("LOWEST : "+d);
}
else if (e<d&&e<f&&e<g){
System.out.println("LOWEST : "+e);
}
else if (f<d&&f<e&&f<g){
System.out.println("LOWEST : "+f);
}
else if (g<d&&g<e&&g<f){
System.out.println("LOWEST : "+g);
}
if (ave>=75){
System.out.println("REMARKS : PASSED");
}
else{
System.out.println("REMARKS : FAILED");
}
}
}
Now here is my problem:
i am going to enter 15 subjects grade.
what if there is two or more lowest or highest grades what should i do?
there must be only one highest and lowest grades.
here is the output:
Enter FirstName:
Enter LastName:
Enter Course:
The Average is:
Highest Grade is:
Lowest Grade is:
Remarks:
thanks in advanced.