Answer to Question #273585 in Java | JSP | JSF for Ema

Question #273585

application and use a Two dimensional array that will store five information technology

8 OfonQ, with the average amount of

stered for each course

Your program must:

Contain a two dimensional array to contain three student registration figures for five

different information technolory courses and a single array to contain the course

Males

COURSE

REGISTRATION I REGISTRATION >

I REGISTRATION 3

Programming 101

50

10

50

Web Dev 101

10

50

20

Databases 101

10

70

Logic 101

Management 101

30

50

Q.2.2 Calculate and print the average of the course registration figures for each IT course

Q.2.3 Determine if the IT course will be run or not. If the average registration figures of the IT

course is greater than or equal to 70 then the IT course will run.

0.2.4 Print out each course name with the average registration and if the course will run


1
Expert's answer
2021-12-01T00:52:58-0500


SOLUTION CODE


package com.company;

class Main {
    public static void main(String[] args)
    {
        //declare a one dimensional array to store the names of the courses
        String [] courses_names = {"Programming 101", "Web Dev 101",
        "Database 101", "Logic 101", "Management 101"};

        //We declare a two dimensional array of 5 by three
        //Rows representing the IT courses and columns representing the three students
        int[][] student_marks = {
                {50, 10, 50},
                {10, 50, 20},
                {85, 70, 80},
                {20, 40, 90},
                {60, 90, 70}
        };

        //Calculate the average of each IT course
        System.out.println("\n");
        for(int i = 0; i< 5; i++)
        {
            int sum = 0;
            for(int j = 0; j<3; j++)
            {
                sum = sum + student_marks[i][j];
            }
            System.out.println("The average mark for "+courses_names[i]+" = "+(sum/3));
        }

        //Print out each course name with the
        // average registration and if the course will run
        System.out.println("\n");
        for(int i = 0; i< 5; i++)
        {
            int sum = 0;
            for(int j = 0; j<3; j++)
            {
                sum = sum + student_marks[i][j];
            }

            double average = sum/3;
            if(average >=70)
            {
                System.out.println("The average mark for "+courses_names[i]+" is "
                        +average+ " and it will run");
            }
            else
            {
                System.out.println("The average mark for "+courses_names[i]+" is "
                        +average+ " and it not will run");
            }
        }


    }
}


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