Created
January 20, 2012 21:31
-
-
Save jesusangelm/1649716 to your computer and use it in GitHub Desktop.
Script en Ruby para felicitar a una persona por su cumpleaños - Version POO
This file contains 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
#!/usr/bin/env ruby | |
#coding: utf-8 | |
# Felicitador V2.0 POO | |
class Cumple | |
def initialize(nombre, anios) | |
@minombre = nombre | |
@mianios = anios | |
end | |
def felicita | |
puts "Favor ingresa tu nombre" | |
@minombre = gets.chomp | |
puts "#{@minombre} cuantos años cumples???" | |
@mianios = gets.chomp.to_i | |
@mianios.times do |num| | |
puts "#{num.to_s} Feliz Cumpleaños #{@minombre}!!!" | |
end | |
end | |
end | |
cumpleanero = Cumple.new(@minombre, @mianios) | |
puts cumpleanero.felicita |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment