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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started