hi all
Hi
i build program. it is a selection. if else. where it ask the user to enter 3 marks for a student. the student pass if their grades is greater than or equal to 50 and they fail if their grades is less than 50, right
my problems is, it works but there is a logical error somewhere in the program. if i enter marks that is more than 50 it tell me they student fail when it should say pay and it tell me the same when i enter marks that is less than 50. tell me where i have gone awary. here is the codes that i use
double mark1, mark2,mark3, avemark, totalmarks = 0;
double passmark=0;
System.out.println("please enter mark 1");
mark1 = userinput.nextDouble();
System.out.println("please enter mark 2");
mark2 = userinput.nextDouble();
System.out.println("please enter mark 3");
mark3 = userinput.nextDouble();
avemark = (mark1 + mark2 + mark3);
totalmarks = (totalmarks / 3);
if(passmark >=50)
{
System.out.println("student pass");
}
else if(passmark <=50)
{
System.out.println("student fail");