Then, watch each video below, entering the code shown into TryRuby and running the code. You must take screenshots as specified below to record your completion of the activity.
Important! Don’t just imitate the steps without understanding them. Be sure to pay close attention to what’s being said in the video, so you gain a deep understanding of how OOP in Ruby is actually done. If you have questions, don’t hesitate to post them to the #help-help-help channel in Discord.
Important! All screenshots must include your computer’s desktop in the background so that it is recognizable as your desktop.
Create Very Basic Class with Default Constructor
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Add a Getter Method to the Class
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Add Parameters to the Constructor
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Define Default Parameter Values for the Constructor
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Add a Setter Method to the Class
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Generate an Attribute with Getter and Setter Methods
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Make Two Collaborating Objects
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Add a Method That Is More than a Mere Getter/Setter
Perform the coding steps from the video in TryRuby Playground and take a screenshot for the final result including program output.
Test Yourself!
Consider this object diagram similar to the one shown in the videos.
Create a Student class and an Email class with attributes as shown in the image.
Generate getter and setter methods for the attributes using attr_accessor declarations.
Instantiate the Student class to create a Student object and set its attribute values as depicted in the diagram (e.g., with first_name set to “Alice”).
Hint: Setting the Student object attributes will involve creating an Email object as well (again, as per the figure).
Finally, print the Student object’s data to the console (using puts) such that the output looks as follows.
Andrews, Alice (alice.a@memphis.edu)
Take screenshots that capture all your code and the program output.
Submit to Canvas!
Insert your all your screenshots into a Word DOCX and submit the file in the appropriate Canvas Assignment.