Answer to Question #261978 in Java | JSP | JSF for Chakalaka

Question #261978

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


1
Expert's answer
2021-11-06T18:56:52-0400


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE


package com.company;

public class Main {
    //This function calculates the qualifying marks and tells whether a student has qualified or not
    public static void qualifying_students(String [] student_names, double [] final_test_mark, double [] assignment_mark) {
        int arrays_length = student_names.length;
        System.out.println("\n");
        for(int i = 0; i<arrays_length;i++)
        {
           //calculate the mark of the student
           double assignment =  (0.6)*assignment_mark[i];
           double final_test = (0.4)*final_test_mark[i];
           double qualify = assignment + final_test;
           if(qualify == 50 || qualify>50)
           {
               System.out.println(student_names[i]+" got "+qualify+" and has qualified");
           }
           else
           {
               System.out.println(student_names[i]+" got "+qualify+" and has not qualified");

           }
        }
    }

    public static void main(String[] args) {

        String [] student_names = {"kelly","daniel","Nyamai","steve","Stella"};
        double [] final_test = {70, 80, 49, 85,60};
        double [] assignment = {50, 60, 45, 75, 25};
        //Let us write the main method and call our students_qulaify method
        qualifying_students(student_names,final_test,assignment);
    }
}



SAMPLE PROGRAM OUTPUT





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