Created
September 9, 2011 18:25
-
-
Save padi/1206953 to your computer and use it in GitHub Desktop.
Tubig na Aso
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Aso | |
| def initialize(name) | |
| @name = name | |
| end | |
| end | |
| class TubigNaAso < Aso | |
| def initialize name | |
| @name = "TubigNa" + name | |
| end | |
| def put_name | |
| @name + ": " | |
| end | |
| def bark | |
| print put_name | |
| (1 + rand(6)).times { |d| print "woof! " } | |
| end | |
| def pee | |
| print put_name, "sssssss......" | |
| end | |
| def rollover | |
| print put_name, bark, "*rolls*", bark | |
| end | |
| def tagalog_bark | |
| (1 + rand(6)).times { print "aw! " } | |
| end | |
| end | |
| jojo = TubigNaAso.new("Jojo") | |
| while true | |
| print "Play with jojo (y/n) ? " | |
| play = gets.chomp | |
| break if play.empty? || play == "n" | |
| puts jojo.bark | |
| puts jojo.rollover | |
| puts jojo.pee | |
| puts jojo.tagalog_bark | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment