Question: Given a class called Student and a class called Course that contains an ArrayList of Student. Write a method called countProbation() as described below. Refer

Given a class called Student and a class called Course that contains an ArrayList of Student. Write a method called countProbation() as described below. Refer to Student.java below to learn what methods are available.

Code:

import java.util.*; import java.io.*; /****************************************************** * A list of students in a course *****************************************************/ public class Course{

/** collection of Students */ private ArrayList roster;

/***************************************************** Constructor for objects of class Course *****************************************************/ public Course(){ roster = new ArrayList(); }

/***************************************************** @return number of students with a GPA below 2.0 *****************************************************/ public int countProbation(){ /** Your code goes here */ } /***************************************************** Add a student to the course *****************************************************/ public void addStudent(Student s){ roster.add(s); } /***************************************************** Main method for testing *****************************************************/ public static void main(String args[]){ Course cis162 = new Course(); cis162.addStudent(new Student("Henry", "Cabot", 3.2)); cis162.addStudent(new Student("Brenda", "Stern", 1.2)); cis162.addStudent(new Student("Lynda", "Robison", 3.2)); cis162.addStudent(new Student("Jane", "Flynn", 1.2)); int prob = cis162.countProbation(); } }

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!