Create a JAVA simply programs that manages scores following a 2-dimensional array, students can be identified with rows, scores indefity with the columns. Ask user to input number of science students for the #of tests (size of 2-D array. Array must get populated with user input (numbers for scores ranging from 0-100). Note that >= 60 equals a passing grade. Next, 2 methods 1. Calculate # of tests passed by each student  2.Calculate # of students passed for each test Note that the Method will accept the two-D array as 1 argument & specific student # (for(a)) or a specific test # (for(b)) as next argument. Methods return the counts if correct.  Next you will Call the above methods (from main) by passing 2-D array with the scores, for each student (for(a)) and each test (for (b)). Print all counts.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Create a JAVA simply programs that manages scores following a 2-dimensional array, students can be identified with rows, scores indefity with the columns. Ask user to input number of science students for the #of tests (size of 2-D array. Array must get populated with user input (numbers for scores ranging from 0-100). Note that >= 60 equals a passing grade.

Next, 2 methods

1. Calculate # of tests passed by each student 

2.Calculate # of students passed for each test

Note that the Method will accept the two-D array as 1 argument & specific student # (for(a)) or a specific test # (for(b)) as next argument. Methods return the counts if correct. 

Next you will Call the above methods (from main) by passing 2-D array with the scores, for each student (for(a)) and each test (for (b)). Print all counts. 

 

Expert Solution
Step 1

I have implemented the requirements as per specification. The code for the above is:

import java.util.Scanner;

public class StudentScore {
    public static int countTests(int[][] studentScores, int student) {
        int count = 0;
        for(int i = 0; i < studentScores[student].length; i++) {
            if(studentScores[student][i] >= 60)
                count++;
        }
        return count;
    }
    public static int countStudents(int[][] studentScores, int test) {
        int count = 0;
        for(int i = 0; i < studentScores.length; i++) {
            if(studentScores[i][test] >= 60)
                count++;
        }
        return count;
    }
    public static void main(String[] args) {
        int noStudents, noTests, countStudent, countTest;
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the number of students: ");
        noStudents = Integer.parseInt(sc.nextLine());
        System.out.println("Enter the number of tests: ");
        noTests = Integer.parseInt(sc.nextLine());
        int[][] studentScores = new int[noStudents][noTests];
        for(int i = 0; i < noStudents; i++) {
            System.out.println("Test Scores of student #" + (i + 1) + ": ");
            for(int j = 0; j < noTests; j++)
                studentScores[i][j] = sc.nextInt();
            sc.nextLine();
        }
        System.out.println("=======================================================");
        for(int i = 0; i < noStudents; i++) {
            countTest = countTests(studentScores, i);
            System.out.println("Student #" + (i + 1) + " passed " + countTest + " tests.");
        }
        System.out.println("=======================================================");
        for(int i = 0; i < noTests; i++) {
            countStudent = countStudents(studentScores, i);
            System.out.println("Test #" + (i + 1) + " passed by" + countStudent + " students.");
        }
        System.out.println("=======================================================");
        sc.close();
    }
}
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY