Question: Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Notes: Assume that the classes listed in the Java Quick
Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Notes: Assume that the classes listed in the Java Quick Reference have been imported where appropriate Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit. 1. This question involves a system to manage a student's assignments in a course. Assignments are represented by the following Assignment class. public class Assignment { /** Returns the title of the assignment */ public String getTitle() { * implementation not shown */ } /** Returns the grade earned for the assignment Postcondition: The value returned is greater than or equal to e. . public int getGrade() { /* implementation not shown */ } /** Sets the grade for the assignment to x */ public void setGrade(int x) { / implementation not shown */ } /** Returns the category of the assignment / public String getCategory { /* implementation not shown */ } A student's assignments for a course are stored in a StudentAssignments object, which contains a list of the student's assignments. You will implement two methods in this class. public class StudentAssignments { /** A list containing the student's assignments Guaranteed not to be null and to contain only non-null entries */ private ArrayList assignmentList; . /** Returns the number of assignments in a given category that have a grade greater than or equal to 90, as described in part (a) public int getNumberOfAs (String cat) { / to be implemented in part (a) */ } /** Replaces a single assignment grade in a given category if the number of As in the category is greater than 5 but at least one score is below 70, as described in part (6) public void updateGrade(String cat) { /to be implemented in part (b) */ } // There may be instance variables, constructors, and methods that are not shown. } (a) Write the StudentAssignments method getNumberOfAs. The method returns the number of assignments in a given category that have a grade greater than or equal to 90. Complete method getNumberOfAs. (a) Write the StudentAssignments method getNumberOfAs. The method returns the number of assignments in a given category that have a grade greater than or equal to 9e. Complete method getNumberOfAs. /** Returns the number of assignments in a given category that have a grade greater than or equal to 90, as described in part (a) */ public int getNumberOfAs (String cat) y ili MI 0/10000 Word Limit (b) Write the studentAssignments method updateGrade. The method replaces one and only one grade below 70 in a given category, if any such grade exists and if the given category has more than five assignments with a grade of A. The identified grade is replaced with the value 70. If more than one such assignment exists, the grade of any one of those assignments may be replaced. Assume that getNumberOfAs works as specified, regardless of what you wrote for part (a). You must use getNumberOfAs appropriately to receive full credit Complete method updateGrade. /** Replaces a single assignment grade in a given category if the number of As in the category is greater than 5 but at least one score is below 70, as described in part (b) * public void updateGrade(String cat) B 1 Sii TI B I u 0/10000 Word Limit (c) The programmer would like to add a method called getAllGroupAssignments that returns a list of assignments that have been designated as having parts where students worked in groups. A group assignment can appear in any category. Write a description of how you would change the Assignment and StudentAssignments classes in order to support this modification. Make sure to include the following in your response. Write the method header for the getAllGroupAssignments method. Identify any new or modified variables, constructors, or methods aside from the getAllGroupAssignments method. Do not write the program code for this change. Describe, for each new or revised variable, constructor, or method, how it would change or be implemented, including visibility and type. You do not need to describe the getallGroupAssignments method. Do not write the program code for this change. B I 0 / 10000 Word Limit