Assignment 3: The Facets of Ruby, Part II
ProblemsPage 1 of 4

1. Programming a Music Library Part I

If you recall the story for this assignment, you were supposed to make a simple music library. Let's get some things done.

Notations

In Ruby, because hashes and arrays are so common, it's very common to use them as function arguments or instance variables. To avoid confusion, it helps to use notations like this:

Above means that @info is a hash instance variable, whose keys are :album, :artist, and name. And @play_count is an integer instance variable. Note that the default of @play_count is 0, if unspecified during instantiation.

Above means that album and artist are strings, names is an array of strings, and the function returns an array of songs. Feel free to write this in a different notation, but do write something to indicate object types. It will help you - I am speaking from my experience!

Gameplan

We will have 2 classes for a music library:

Next Page

We will write a song class first. Next Page

Assignment 3:
The Facets of Ruby, Part II

Problems