Answer to Question #3750 in Action Script | Flash | Flex | ColdFusion for purnima

Question #3750
Write a program in java to calculate a result of student by the univercity for five subject coundition is
if marks is >=75 first division,
if 65 to74 then second division,
if 55 to 64 then third division,
if 45 to 54 then fail.some other condition is if student fail in one subject then reapear,
2 fail then fail.
1
Expert's answer
2011-07-29T14:18:37-0400
import java.util.*;public class Mark {
public static boolean division(int mark) {
if (mark >= 75)
System.out.println("first division");
else if (mark >= 65)
System.out.println("second division");
else if (mark >= 55)
System.out.println("third division");
else {
System.out.println("fail");
return true;
}
return false;
}

public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int mark;
int fail = 0;
for (int i = 0; i < 5; i++) {
mark = scan.nextInt();
System.out.print((i + 1) + " subject : ");
if (division(mark))
fail++;
}
if (fail == 1) {
System.out.println("Repear subject in which you have a fail");
mark = scan.nextInt();
if (division(mark))
System.out.println("Fail");
else
System.out.println("Not fail");
} else if (fail > 1)
System.out.println("Fail");
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS