• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

I need a method...

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all!
I have about about 12 if else construct blocks which I need to optimize. The blocks look like this:
Code removed JdJ
I'm stuck as to what method I can add to streamline these blocks. Thanks for the help.
~Ed
[This message has been edited by Johannes de Jong (edited July 06, 2001).]
 
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Ed I thought you gave away to much to other students with the code you posted. So I removed it.
Look at your code carefully. There is a lot of repetition in it. This is normally an indication that you could/should create a method youself.
Good luck.
 
Ed Byrnes
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Johannes de Jong!
Okay, I'm thinking of two possibilities:
1.] Each block checks for certain three character strings and the program may also have to check for certain two character strings.
2.] Depending upon the length of a string, the blocks have to print up to four strings common to each block.
I'm thinking a method for the first would be the best bet. Yes?

~Ed
 
Johannes de Jong
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither Ed .
I suggest you look a this posting Say. I think about everything that could be said to help with your problem is there.
If not lets us know.
wonder what happened to Rashid??
 
The problems of the world fade way as you eat a piece of pie. This tiny ad has never known problems:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic