Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.adoc
strategy.rb
strategy_test.rb

README.adoc

Class Exercise: Strategy Pattern

Study carefully the classes called Student, StudentStrategy, and Course contained in the strategy.rb file. They are part of a partial implementation of a software system that uses the strategy pattern. You must implement in this same file three concrete strategies for this system:

  • CountGenderStrategy: Strategy for counting the number of students with a certain gender (male or female) in a course.

  • ComputeAverageGPAStrategy: Strategy for computing the average of all the students’ GPA (Grade Point Average) scores in a course. Returns nil if the course has no students.

  • BestGPAStrategy: Strategy for getting the name of the student with the highest GPA score in a course. Returns nil if the course has no students.

These three classes must extend the StudentStrategy class. See the corresponding unit tests in the strategy_test.rb file for more specific details and examples.

You can’t perform that action at this time.