• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Assignment 1.1 - OS specific?

 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic