(JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students identified by rows and test scores identified by columns. Ask the user for the number of students and for the number of tests (which will be the size of the two-dimensional array). Populate the array with user input (with numbers in {0, 100} for test scores). Assume that a score >= 60 is a pass for the below. Then, write methods for:
Computing the number of tests that each student passed
Computing the number of students passed for each test
The methods should accept a two-dimensional array as one argument and a specific student number (for (a)) or a specific test number (for (b)) as the other argument. The methods should return the relevant counts. Call the above methods (from main) by passing the two-dimensional array that contains the test scores, for each student (for (a)) and then for each test (for (b)). Print the counts. Expert Answer
import java.util.Scanner;
public class StudentTestScores {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("How many students: ");
int nStudents = Integer.parseInt(sc.nextLine().trim());
System.out.print("How many test scores for each student: ");
int nTests = Integer.parseInt(sc.nextLine().trim());
int studentsTests[][] = new int[nStudents][nTests];
System.out.println("\nEnter the test scores for each
student:");
for(int i = 0; i < nStudents; i++)
{
System.out.println("Student " + (i + 1) + ": ");
for(int j = 0; j < nTests; j++)
{
studentsTests[i][j] = Integer.parseInt(sc.nextLine().trim());
}
System.out.println();
}
System.out.println();
// METHOD 1
int studentNumber = 1; // sample test
studentNumber--;
if(studentNumber < 0)
studentNumber = 0;
int testsEachStudentPassed = NTestsEachStudentPassed(studentsTests,
studentNumber);
System.out.println("Number of tests Student " + (studentNumber + 1)
+ " passed = " + testsEachStudentPassed);
// METHOD 2
int testNumber = 2; // sample test
testNumber--;
if(testNumber < 0)
testNumber = 0;
int studentsEachTestPassed = NStudentsEachTestPassed(studentsTests,
testNumber);
System.out.println("Number of students passed Test " + (testNumber
+ 1) + " = " + studentsEachTestPassed);
}
// this method takes the 2-d array and a student number as
input
// and returns the number of tests the student passed for
private static int NTestsEachStudentPassed(int students[][], int
studentNumber)
{
int count = 0;
if(studentNumber < 0 || studentNumber >
students.length)
System.out.println("\nInvalid student number!");
else
{
for(int i = 0; i < students[studentNumber].length; i++)
{
if(students[studentNumber][i] >= 60)
count++;
}
}
return count;
}
// this method takes the 2-d array and a test number as input
// and returns the number of students passed for that test
number
private static int NStudentsEachTestPassed(int students[][], int
testNumber)
{
int count = 0;
if(testNumber < 0 || testNumber > students[0].length)
System.out.println("\nInvalid test number!");
else
{
for(int i = 0; i < students.length; i++)
{
if(students[i][testNumber] >= 60)
count++;
}
}
return count;
}
}
********************************************************************* SCREENSHOT ******************************************************

(JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students...
Consider the following program that reads students’ test scores into an array and prints the contents of the array. You will add more functions to the program. The instructions are given below. For each of the following exercises, write a function and make the appropriate function call in main.Comments are to be added in the program. 1. Write a void function to find the average test score for each student and store in an array studentAvgs. void AverageScores( const int scores[][MAX_TESTS], int...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...
Java Programming (use jGrasp if not thats fine) Write a Two classes one class that creates a two-dimensional 2 rows by 3 columns double array. This class will have a separate method for the user to populate the array with data values. The other class that has the following methods: getTotal. This method should accept a two-dimensional array as its argument and return the total of all the values in the array. getAverage. This method should accept a two-dimensional array...
IN JAVA WITH COMMENTS, The assignment: This program inputs the names of 5 students and the (integer) grades they earned in 3 tests. It then outputs the average grade for each student. It also outputs the highest grade a student earned in each test, and the average of all grades in each test. Your output should look like this: Mary's average grade was 78.8% Harry's average grade was 67.7% etc... : In test 1 the highest grade was 93% and...
Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...
For C++ program Your program should first prompt the user for the number of students they wish to enter. For each student, the user will be prompted to enter the student’s name, how many tests the student has taken, and the grade for each test. Each test’s grade will be inputted as a number representing the grade for that test. Once each student’s information has been entered, the program will display the number of students. Additionally, each student will have...
Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....
Write a class named TestScores. The class constructor should accept an array of test scores as its argument. The class should have a method that returns the average of the test scores. If any test score in the array is negative or greater than 100, the class should throw an IllegalArgumentException. Demonstrate the class in a program (create a Driver class in the same file). The program should ask the user to input the number of test scores to be...
CSC888 has 4 people. Each person needs to take 3 tests. Create a 4-by-3 two-dimensional array to store the test scores. Ask the user to enter test scores one at a time to populate this array. Once the whole array is filled, do the following two things. (1) For each student, display her test scores and the average of the three tests. (2) For each test, display student scores and the average of the four students. The following shows a...
Write a javascript program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: calcAverage—This method should accept five test scores as arguments and return the average of the scores. determineGrade—This method should accept a test score as an argument and return a letter grade for the score,