Answer to Question #260911 in Java | JSP | JSF for Amadix

Question #260911

Using the above code add a method that takes in three arrays, one for student names, one for final test marks and a last one for assignment mark. The method should then calculate the students qualifying mark (a student needs 50 or more to qualify) using the following weights: 40% of the test and 60% of the assignment, finally print out whether the person qualified or not. [10]


1
Expert's answer
2021-11-04T00:24:02-0400
public class Main {
    public static void checkQualifies(String[] names, int[][] testMarks, int[] assignmentMarks) {
        double total;
        for (int i = 0; i < names.length; i++) {
            total = 0;
            System.out.print(names[i] + " ");
            for (int j = 0; j < testMarks[i].length; j++) {
                total += testMarks[i][j];
                System.out.print(testMarks[i][j] + " ");
            }
            total /= testMarks[i].length;
            total *= 0.4;
            System.out.print(assignmentMarks[i] + " ");
            total += (0.6 * assignmentMarks[i]);
            if (total >= 50) {
                System.out.println("Allowed");
            } else {
                System.out.println("Denied");
            }
        }
    }

    public static void main(String[] args) {
        checkQualifies(new String[]{"King", "John"}, new int[][]{{59, 85}, {52, 45}}, new int[]{75, 48});
    }
}

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