Capitalizing/ formatting with string methods( capitalize!)


#1

For the life of me I don't know what the ■■■■ is wanted of me. all things have been capitalized and still it gives me error codes. on a side not. WHY IS THERE NOT MORE IN LESSON HELP. its an enormous pain in the ■■■ to have to slog through endless unhelpful posts in these forums where it seems a lot of people want to help, but don't know much more than you. ARE THER ANY PROS HERE or is that something you pay for?
Anyhow, if anyone has an idea about why this code isn't working, please help.

print "what's your first name?"
first_name = gets.chomp
first_name = "james".capitalize
puts "your name is #{first_name}!"
print "what's your last name?"
last_name = gets.chomp
last_name = "ford".capitalize
puts "your last name is #{last_name}!"

print " what city are you from?"
city = gets.chomp
city = "myrtlebeach".capitalize
print " what state or province are you from?"
state = gets.chomp
state = "South Carolina".upcase
puts "you are from #{city},#{state}"



#2

Hi you should read well the instruction...

1. After each variable assignment: first_name, last_name, and city add the .capitalize! method
For state use the .upcase! method
you should add at the end

!

of .capitalize! and upcase!
Hope that could help you


#3

Let's look at these four lines from your program.

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

The first line there displays a message to the user and the second line gets their response and stores it in first_name. So if I were using your program, I would have answered Albions so first_name would now have a value of Albions.

first_name = "james".capitalize

Then on that line you have changed the value of first_name to james.capitalize so first_name now has a value of James -- that would be very confusing for all of your users whose name wasn't James.

If you need to know about using ! you can read this: