Tuesday, October 22, 2013

Noob Tutorials #3 Ruby Code chapter 6

in this week we half to make a ANGRY BOOS program were he asks what you want and whatever you say it will yell it back to you and then fire you for example if you say "i want a raise" he will say
WHADDAYA MEAN "I WANT A RAISE"?!? YOU'RE FIRED and how you program it is


puts "what do you want!"
want =gets.chomp
puts 'WHADDAYA MEAN ' + want.upcase + '?!? YOU\'RE FIRED'


and the other one was a table of contents witch was not so easy what you need to do is


line_width = 50
puts( '--------------------------------------------------')
puts( 'table of contents'.center(line_width))
puts ('chapter 1: getting started'.ljust( line_width/2)) + ('page 1'.rjust((line_width-1)/2))
puts ('chapter 2: numbers'.ljust( line_width/2)) + ('page 9'.rjust(line_width/2))
puts ('chapter 3: letters'.ljust( line_width/2)) + ('page 13'.rjust(line_width/2))

i hope this helps you for this chapter good luck on programing

No comments:

Post a Comment