• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Calculation

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, for assignment 1b, I trying to come up with a simplier calculation than this one below...any ideas?

[code removed]

then I use a for and while loop to print most of the names, and the another while loop to print the remainder...any ideas on how to make the calculation simplier or somewhere I can read how?

thanks..

[Nath: we don't allow code from the assignments here. Would you try to explain what you are thinking without the code?]
[ March 16, 2008: Message edited by: Katrina Owen ]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
True. You can use pseudocode (code in English rather than Java).

You know you have to write 100 names - that has for loop written all over it. Depending on the width of the name, figure out how many times you will write it per line (we'll call this something like "namesPerLine").

I think you shouldn't need a while loop.
[ March 17, 2008: Message edited by: Marilyn de Queiroz ]
 
I found some pretty shells, some sea glass and this lovely tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic