Welcome to Boating School, a Spongebob activity that simulates a system that tracks Boating Tests. We have three models - Student
, Instructor
, and BoatingTest
.
Associations:
Student
class:
Student#grade_percentage
should return the percentage of tests that the student has passed, a Float (so if a student has passed 3 / 9 tests that they've taken, this method should return the Float33.33
)
Instructor#pass_student
should take in a student instance and test name. If there is aBoatingTest
whose name and student match the values passed in, this method should update the status of that BoatingTest to 'passed'. If there is no matching test, this method should create a test with the student, that boat test name, and the status 'passed'. Either way, it should return theBoatingTest
instance.Instructor#fail_student
should take in a student instance and test name. Like#pass_student
, it should try to find a matchingBoatingTest
and update its status to 'failed'. If it cannot find an existingBoatingTest
, it should create one with the name, the matching student, and the status 'failed'.
NOTE: Test status has three options only ("passed", "failed" and "pending")
Run ruby tools/console.rb
in console to try out your code. You can add seed data to this file to have some sample objects to try out.
Here is some example seed data:
spongebob = Student.new("Spongebob")
patrick= Student.new("Patrick")
puff= Instructor.new("Ms.Puff")
krabs= Instructor.new("Mr.Krabs")
no_crashing = spongebob.add_boating_test("Don't Crash 101", "pending", puff)
power_steering_failure = patrick.add_boating_test("Power Steering 202", "failed", puff)
power_steering_pass = patrick.add_boating_test("Power Steering 201", "passed", krabs)