It's not a secret anymore!*
The moose likes Cattle Drive and the fly likes Assignment 1.1 - OS specific? 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.1 - OS specific?" Watch "Assignment 1.1 - OS specific?" New topic
Author

Assignment 1.1 - OS specific?

Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Marilyn,
In my Assignment 1.1 nitpick there is the following comment :
Looks like you are depending on something that the operating system does. I suggest that, instead, you simply avoid the 80th character and always force a new line at the end of each line

I believe it is about this line :

I've looked in the API reference and I can't seem to fine any way to get the current line width of the system...
Can you give me any more hints on what to do?
Thanks,
-Nate

[This message has been edited by Nathan Pruett (edited January 31, 2001).]


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
soumya ravindranath
Ranch Hand

Joined: Jan 26, 2001
Posts: 300
hi Marilyn,

i too got a similar comment on my assignment 1.1 (depending on the behaviour of one particular OS). What do u mean by 'avoid the 80th character' ?
Also, do i have to take care of 'divide by zero' that i get if the word is 78 / 79 characters long ?
regards,
soumya.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Originally posted by Nathan Pruett:
I've looked in the API reference and I can't seem to fine any way to get the current line width of the system...


Assume that there are 80 characters per line. Don't depend on an automatic word wrap that may occur with one OS. Figure out how many words will fit on a line in advance and force a new line each time you print that many words.

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Originally posted by soumya ravindranath:
i too got a similar comment on my assignment 1.1 (depending on the behaviour of one particular OS). What do u mean by 'avoid the 80th character' ?
Also, do i have to take care of 'divide by zero' that i get if the word is 78 / 79 characters long ?

Make sure the last word in your line does not write to the 80th column, because in some systems you will print an extra blank line if you do.

You can assume the word will not be any longer than 30 characters. Do you know someone with a name that is 78 characters long?
soumya ravindranath
Ranch Hand

Joined: Jan 26, 2001
Posts: 300
hi,

Is it ok to keep posting the assignment everyday with the changes or is it better to check out on this forum, get doubts clarified and make less no. of emailing to u, Marilyn ? (because i am some 6-10 hrs. ahead of u, i have to wait for at least two days before i can make the next submission. ( and at the rate it's going, i donno if i will reach the second assignment in the near future )
thanq,
soumya.
[This message has been edited by soumya ravindranath (edited February 01, 2001).]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
It's better to post your questions in the forum. Even if you send me more than one email per day, I'm only going to look at one. So send me your best one.
 
GeeCON Prague 2014
 
subject: Assignment 1.1 - OS specific?