File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Cattle Drive and the fly likes Assignment 1-b 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 1-b" Watch "Assignment 1-b" New topic

Assignment 1-b

Debbie Christian

Joined: Mar 26, 2001
Posts: 8
I am utterly confused.
The following is a part of my submission for ib -
> //calculate number of complete lines that is possible

(Marilyn deleted code to protect future participants)

- and I got nitpicked as follows -
What happens if the name is just perfectly long enough that you
write exactly 80 characters? ( like "sue", "bill" or "marilyn" )
- that and the fact that when use 'bill' to run the program, it[ the program] inserted an extra line between the lines, made me think that I needed to count the nbr of chars being printed to the screen. This I did and got nitpicked as follows -
Looks like you are depending on something that the operating system
does. The program will be simpler if you don't concern yourself with
squeezing in that last tidbit of optimization. I suggest that instead, you
simply avoid the 80th character and always force a new line at the end of
each line.
- but I did start a new line after every line that was printed -


[This message has been edited by Marilyn deQueiroz (edited April 05, 2001).]
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
The problem is that not all consols behave the same way. If you do checking to see if you if you hit the 80th spot exactly and then not have it force a line in that case, it will work on some but maybe not others. Just avoiding the 80th character in the first place is easier and a more elegant solution.
John Bateman
Ranch Hand

Joined: Mar 09, 2000
Posts: 320
I want to say how I did it because I am thinking it will be considered a 'cheat'. But I don't want to give anything away...
What a dilemna

SOURCE CODE should be SURROUNDED by "code" tags.
Click here for an example

SOURCE CODE should be SURROUNDED by "code" tags.
I agree. Here's the link:
subject: Assignment 1-b
It's not a secret anymore!