Kamis, 06 Mei 2010

listing pemograman sederhana RUBY

puts '--ZODIAK--'

print 'Masukan Angka Bulan Lahir Anda : '

n=gets.to_i

bulan={1=>"January",2=>"Febuary",3=>"Maret",4=>"April",5=>"Mei",6=>"Juni",7=>"July",8=>"Agustus",9=>"September",10=>"Oktober",11=>"November",12=>"Desember"}

jmlhr={"January"=>31,"Febuary"=>28,"Maret"=>31,"April"=>30,"Mei"=>31,"Juni"=>30,"July"=>31,"Agustus"=>31,"September"=>30,"Oktober"=>31,"November"=>30,"Desember"=>31}

zodiak={"January"=>"Capricorn","Febuary"=>"Aquarius","Maret"=>"Pisces","April"=>"Aries","Mei"=>"Taurus","Juni"=>"Gemini","July"=>"Leo","Agustus"=>"Leo","September"=>"Virgo","Oktober"=>"Libra","November"=>"Scorpio","Desember"=>"Sagitarius"}

puts ""

print "Bulan Anda : ",bulan[n]

puts""

print "Jumlah hari pada bulan Anda : ",jmlhr[bulan[n]]," hari"

puts ""

print "Zodiak Anda : ",zodiak[bulan[n]]

Tidak ada komentar:

Posting Komentar