Question: [Note: In week 8 or 9 you can expect a quiz with some collection problem where you will be asked to design and code (into
[Note: In week 8 or 9 you can expect a quiz with some collection problem where you will be asked to design and code (into a textbox, NOT in Blue)!) a class and its methods somewhat similar to RollBook example below.] Use Blue) to design, code and test two classes to model a solution to the following problem. HINT: the problem is one class that contains as an instance variable a "Collection of instances of another class. A RollBook contains zero or more instances of Student such as "Doe. John" or "Brown, Sally" Each Student has a name as a single string in format shown above ("Last, First") Each Student has a street address [omitted in this lab) and a zipCode as a 5-character String A Student also has a gpa which is a decimal number in the range 0.0 to 4.0 1. Code class Student sufficient to model the above problem. -- Hint: instance variables, a constructor with two parameters, and two accessor methods. 2. Code class RollBook with custom methods to void add Student(String name, String zip, double gpa) //adds to collection Compute the average gpa of all students -- returns value as a decimal number (we did this one in class 7A] Count the number of students Hint: pay close attention to return type needed for with gpa higher than some each method below parameter value [e-g.. 3.2 Hint: read carefully to design an appropriate method value counts all students with name (no spces!) and the necessary parameter(s) gpa greater than or equal to needed for each method 3.2] - returns count Determine if a student with a particular name (or part of a name) is in the class - returns true or false. [Example: is "Brown," in the class?] LIST (output to screen) the names and gpa's of all students who live in a given zipCode (passed as a parameter) -- void method public void listByZipCode(String zip) TESTING: create an instance of RollBook, add test data, and invoke all your methods to verify that they are working as expected! Deliverable: Zip of your Blue) project folder, plus Word doc with screen shots and comments documenting your development and testing. In submission textbox, be sure to note any known defects
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
