Formatting with strings methods help


#1

I need help with this one. I don't know how to add capitalize to the first name, last, city and upcase for state . Plz give me a hand


#2

Hi remove the dot before upcase!


state = .upcase!
`


#3

I don't know what to do now man, i wrote answer and it doesn't work.


#4

Let's rethink this a little bit.

You are writing a program here, and the first thing you want to do is get the user's first_name. You should ask them that instead of "This is my question?".

Once you get their response, store it in a place like first_name, not answer.

Do you see how that will be more useful?


#5

I give up man, i really don't know what to write


#6

I can see that you already know how to display some text on the screen.

My first question for you is, why would you display "This is my question?", why not display "What's your first name?"?

Just tell me what you are thinking about that one line.


#7

You mean like this? ok but still no clue :frowning:


#8

Yes! line 1 is perfect now.

Next, instead of storing the response in answer, like you have done on line 2, why not store it in something more recognizable to you, like first_name?


#9


#10

You aren't quite getting my point.

Originally, you stored the user's response in answer:

answer = gets.chomp

I'm asking you, why not store their response in first_name:

first_name = gets.chomp

Maybe you are not understanding what gets.chomp is doing for you?


#11

can you explain it to me please? i didn't understand it very well.


#12

ok, i did that but now when they ask me what's my first name what the ■■■■ i must write.


#13

When you ask the user a question, you need a way to get their response. That is what get.chomp does for you.

  1. You print a question for the user,
  2. They type an answer
  3. You get.chomp it and save it for later.

#14

You can answer with anything really, but your first name would be the normal response.


#15

Doesn't work man. I wrote my first name and it doesn't work


#16

Well, we've only done the trouble shooting on lines 1 and 2. If you have those right, we can move on to line 3.


#17

Ok, can we move on to line 3?


#18

The next thing the exercise wants you to do with the new first_name variable is make sure that the first letter is uppercase. You can do that like this:

first_name.captialize!

#19


#20

You are getting closer! Are you planning on using that answer2 variable for anything ? I would suggest deleting line 3.

And really, everything else too, except for the three lines that we have been working on so far.