write a java program (use if else).......display those information...
Testing: Please create testing report by including the output summary of the 4 students. Among the 4 students, there should be 1 student who passes all modules exam and attendance (Remark: Congratulation! You pass the module!), 1 student who passes all modules exam but fails some attendance (Remark: You fail the module due to low attendance. Please attend the make up classes.), 1 student who fails some module exam but pass all modules attendance (Remark: You fail the module. Please take the re-exam.), 1 student who fails some modules in both exam and attendance (Remark: You fail the module. Please retake the module.)
public class Main {
public static void main(String[] args) {
boolean[][] students = {
{false, true, true},
{true, true, true},
{false, false, false},
{true, true, false}};
for (int i = 0; i < students.length; i++) {
System.out.println("Student " + (i + 1));
if (students[i][0] && students[i][1] && students[i][2]) {
System.out.println("Congratulation! You pass the module!");
} else if (students[i][0] && students[i][1]) {
System.out.println("You fail the module due to low attendance. Please attend the make up classes.");
} else if ((students[i][0] || students[i][1]) && students[i][2]) {
System.out.println("You fail the module. Please take the re-exam.");
} else {
System.out.println("You fail the module. Please retake the module.");
}
}
}
}
Comments
Leave a comment