Question: Complete the class Roster. A Roster represents the exam grades for students in a class. Copy the starter class from Codecheck Roster has a constructor

Complete the class Roster. A Roster represents the exam grades for students in a class. Copy the starter class from Codecheck

Roster has a constructor that takes a 2d array of a ints as a parameter. This is provided for you. You will need to copy the starter code from Codecheck.

In the 2d array, rows represent all the exam grades of one student. Columns represent the scores by all students on one exam

You are to provide methods

last() which will return the last element in the last row.

studentsFailingGrades(int column) which processes the specified column of exams grades and returns the number of the students with exam grades less than 60 on that exam.

Roster.java

/** * Models the exam grades for a group of students */ public class Roster { private int[][] grades;

public Roster(int[][] scores) { grades = scores; }

//your code here

}

RosterTester.java

public class RosterTester { public static void main(String[] args) { int[][] grades = { {90, 80, 89, 92, 95}, {50, 40, 80, 73, 85}, {80, 45, 91, 80, 75}, {85, 59, 92, 89, 97} }; Roster roster = new Roster(grades); System.out.println("last: " + roster.last()); System.out.println("Expected: 97"); System.out.println("Column 1: " + roster.studentsFailingGrades(1)); System.out.println("Expected: 3"); int count = roster.studentsFailingGrades(0); System.out.println("Column 0: " + count); System.out.println("Expected: 1"); int[][] grades2 = { {90, 80, 89, 92}, {50, 40, 80, 73}, {80, 45, 91, 89} }; Roster roster2 = new Roster(grades2); System.out.println("last: " + roster2.last()); System.out.println("Expected: 89"); } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!