This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assignment 1b

 
Nath Maniedeo
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi I'm having some trouble with Hundred B...like how do we check the console size for example...are they all the same?

My idea is to do a bunch of if loops to check the size of the name.

any help is appreciated.

thanks..
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nath Maniedeo:
how do we check the console size for example...are they all the same?
My idea is to do a bunch of if loops to check the size of the name.


Console sizes are not all the same. However, you should write your code so that the names will fit on an 80-character-size console (even if your console isn't 80 characters wide).

You can get the length of the name with one method call ... name.length()

Now you know the length of the name, and you know the length of the line in the console ... do a simple calculation to see how many names will fit on a line.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic