wood burning stoves*
The moose likes Cattle Drive and the fly likes assignment 1b Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "assignment 1b" Watch "assignment 1b" New topic
Author

assignment 1b

Nath Maniedeo
Greenhorn

Joined: Feb 15, 2008
Posts: 29
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

Joined: Jul 22, 2000
Posts: 9044
    
  10
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.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: assignment 1b
 
Similar Threads
Problem with File Upload
javax.servlet.ServletException: java.lang.IndexOutOfBoundsException: Index: 6, Size: 0
help me to avoid scriptlets, declaration & expression...
errors uploading an image to the database
c:if syntax error