Putting the Form in Formatter

I  Methods, Methods Everywhere

i. What you’ll be building 1/7

Save and Submit

ii. Prompting the User 2/7

print "What's your first name?"

iii. Getting Input 3/7

print "What's your first name?"
first_name = gets.chomp

iv. Repeat for More Input 4/7

print "What's your first name?"
first_name = gets.chomp

print "What's your last name?"
last_name = gets.chomp

print "What's your city's name?"
city = gets.chomp

print "What's your state's abbreviation?"
state = gets.chomp

v. Printing the Output 5/7

print "What's your first name?"
first_name = gets.chomp

print "What's your last name?"
last_name = gets.chomp

print "What's your city's name?"
city = gets.chomp

print "What's your state's abbreviation?"
state = gets.chomp

puts "Your name is #{first_name} #{last_name} and you live in #{city}, #{state}."

vi. Formatting with String Methods 6/7

print "What's your first name?"
first_name = gets.chomp
first_name.capitalize!

print "What's your last name?"
last_name = gets.chomp
last_name.capitalize!
print "What's your city's name?"
city = gets.chomp
city.capitalize!

print "What's your state's abbreviation?"
state = gets.chomp
state.upcase!

puts "Your name is #{first_name} #{last_name} and you live in #{city}, #{state}."

vii. Great Work! 7/7

Save and Submit!

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s