Create a class called Student that models a student at Carleton University. A student's state consists of a name (String), id number (int) and a list of grades (array of doubles). Your class must have a constructor that has three input parameters (name, id and grade list) and sets the initial state for the object. Include a toString() method that returns a useful string representation of a student object. The string representation should contain the student's name, ID number, and the number of grades they have recorded (so NOT include all the grades).
Create a class called Student that models a student at Carleton University. A student's state consists of a name (String), id number (int) and a list of grades (array of doubles). Your class must have a constructor that has three input parameters (name, id and grade list) and sets the initial state for the object.
Include a toString() method that returns a useful string representation of a student object. The string representation should contain the student's name, ID number, and the number of grades they have recorded (so NOT include all the grades).
Include a gradesInRange(double lower, double upper) method that returns the number of grades that this student has that are in the range [lower,upper]. That is, the it returns the number of grades that are greater than or equal to lower and less than or equal to upper.
Example Usage:
Student s = new Student("cat", 100123987, new double[]{81.2, 93.2, 76,2, 84.6});
int num_A_grades = s.gradesInRange(80,100);
// assert num_A_grades will be 3

Step by step
Solved in 2 steps with 1 images









