• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Times.java - maximal hoop jumpage?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Killing time, working ahead on java5, Times.java
Wondering about the intent of the assignment.
I can print the first line of the table three ways:
- as a string (not 'algorithmic' at all, but to the point);
- with a third loop (looks a little silly);
- or, by adding about 10 lines, within the two loops I'm using (much more 'algorithmic', but very nasty looking).
The third way strikes me as getting the most mileage out of the assignment by making me jump through the most hoops, but I can't decide if that's the intent.
Or, should I just wait and submit it the way I like, and see what nits get picked then?
deener
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Readability is the most important thing.
 
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmmm, i don't want to give too much away, but... i passed using one of the 3 methods you listed above. the master solution was actually one of the other 2.
i pondered the same question you are, but i decided to send in a simple solution to get the nitpicks and go from there... i passed on the first try!
keep it simple...
 
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the questions I ask myself when doing the assignments is:
"Am I trying to solve a simple problem with a complex solution?"
 
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
The instructor's solution is not the ONLY solution that is acceptable, as you've probably noticed by now.
 
whippersnapper
Posts: 1843
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marilyn deQueiroz:
The instructor's solution is not the ONLY solution that is acceptable, as you've probably noticed by now.


That's one think I do really like about the process -- that we don't have to come up with the exact same code as in the instructor's solution, but code that still holds up to close examination.
Like Greg, I passed with one version and the instructor had another.
Dean, you can always submit one of the simpler versions, then post your more complicated algorithmic approach to printing the first line in the closed forum for those who've passed the first set of assignments.
I know I'd like to see what you've done.
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The thread has been started. I look forward to seeing your approach as well.
Matthew Phillips
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic