Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Extra credit 1.1

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again. I was asked if I was going to attempt the extra credit for assignment 1.1, and at the time, decided against it, however I think it's in my best interest to just go for it. I need help though. I can't get it straight in my mind where I should begin. Anyone out there that can provide me with the simplest little bit of pseudocode to help me on my way? I'd like a little bit of help, but don't want too much.
 
Trailboss
Posts: 23270
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You write your name 100 times. Depending on the width of the name, figure out how many times you will write it per line. At every n'th iteration, stick in a line feed.
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a dumb question. I put in a counter and had it do a println every 8 times for the extra credit. The response was that I should make it flexible to accommodate for very short or long names. That makes sense, but I think I need to know how many characters I should cut off a line at. How many are there in a line? Does this number depend on what screen resolution people are using? If so, which is the lowest one for which we should design this application?
 
Sheriff
Posts: 9103
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 80 characters in a line.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not necessarily...
While 80 characters per line is the default for many Window's DOS prompts, those settings can and are changed (I usually have mine set at 100 or more).
A truely verbose application would find out the DOS prompt's width and use that in the formulas for computing how many words go on a line. (however, I haven't figured out how to do that just yet; any suggestions?)
 
paul wheaton
Trailboss
Posts: 23270
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the purpose of this assignment, assume that your console has a width of 80 characters.
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello !

What's extra credit ?! I got the instructor's solution for 1.1 ( i could just manage a 'ouch !' when i saw it though ) and am on to 1.2, but i haven't come across this extra credit.... did i miss out on something ?
thanks,
soumya.
 
Marilyn de Queiroz
Sheriff
Posts: 9103
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope, you did the extra credit version, Soumya. You got the names all in columns and not split at the end of the line.
 
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic