Answer to Question #283069 in Java | JSP | JSF for candy

Question #283069

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.)


1
Expert's answer
2021-12-28T01:31:42-0500
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.");
            }
        }
    }
}

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