Day 7.0 Exercise 40 Modules, Classes, and Objects

Here’s my work.
Here’s the link to exercise 40.

Ex40b Code
Ex40b Code
Ex40b Code 2
Ex40b Code 2
Ex40b Output
Ex40b Output

Study Drill

1. Write some more songs using this and make sure you understand that you’re  passing an array of strings as the lyrics.
Done and understood.

2. Put the lyrics in a separate variable, then pass that variable to the class to use instead.
Done, I’ve successfully used a separate variable.

3. See if you can hack on this and make it do more things. Don’t worry if you have no idea how, just give it a try, see what happens. Break it, trash it, trash it, you can’t hurt it.
To be honest, this hurts my head.. I changed the study drill 2, instead of passing a variable, I’ve made it into a hash, because I wanted it to take in 2 arguments. I’ve spent 3 hours on this, tried making a new function to return key or value, nothing works. I finally asked on stack overflow and got an answer from @aqfaridi. Instead of trying to make 2 arguments, he helped me understand that I can change the function to take variable number of arguments.  Thanks @aqfaridi 🙂

4. Search online for “object-oriented programming” and try to overflow your brain with what you read. Don’t worry if it makes absolutely no sense to you. Half of that stuff makes no sense to me too.
Reading it from this site. It’s incomplete, it shows how complicated it is. Haha.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s