Question: (Ruby) Create a class, School, that can be initialized with a name. The School class would be referred to as a model in the domain

(Ruby)

Create a class, School, that can be initialized with a name. The School class would be referred to as a "model" in the domain model context.

A school should have a roster. The roster should be an empty hash upon initialization but will be built out to contain keys of grade levels. The value of each key will be an array of student names.

You should be able to add a student to the school by calling the add_studentmethod and giving it an argument of the student's name and their grade.

A method, grade, should take in an argument of a grade and return all of the students in that grade

You should be able to get a sorted list of all the students where the strings in the student arrays are sorted alphabetically.

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!