This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes CAPS, lowercase, and numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "CAPS, lowercase, and numbers" Watch "CAPS, lowercase, and numbers" New topic
Author

CAPS, lowercase, and numbers

Giovanni Ong
Greenhorn

Joined: Jun 30, 2009
Posts: 4
Well I have an Assignment that asks this... However, I'm having trouble doing this...

Write a program that asks the user to enter the name of his or her favorite city. Use a string variable to store the input. The program should display the following:
• The number of characters in the city name
• The name of the city in all uppercase letters
• The name of the city in all lowercase letters
• The first character in the name of the city
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
The phrase "having trouble" seems to indicate that you've started the assignment, and run into a problem that you can't get past. If so, show us what part you have so far, and then let us know what the problem is.


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Giovanni Ong
Greenhorn

Joined: Jun 30, 2009
Posts: 4
How would I post a Java File here?
Giovanni Ong
Greenhorn

Joined: Jun 30, 2009
Posts: 4
[javadoc]WordGame.class
[/javadoc]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

Giovanni Ong wrote:The number of characters in the city name

java.lang.String; one single method can give you the result
The name of the city in all uppercase letters

Again java.lang.String; one single method can give you the result. Remember though that Strings are immutable, so you'll need to use the following structure:

The name of the city in all lowercase letters

The same applies as for upper case.
The first character in the name of the city

Again, java.lang.String; one single method is enough.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38424
    
  23
Giovanni Ong wrote:[ javadoc]WordGame.class
[ /javadoc]
Are you sure? Surely you mean to use the Code button? Push the Code button, then copy and paste the code between the two tags in square brackets.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CAPS, lowercase, and numbers