• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

void Say4b( String whilePullingOutHair )

 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My code looks something like this

The number that userInput is being tested against gets progressively smaller, as does userInput. The nitpick I received is that there is a lot of similar code, which leads me to believe that this could be simplified. This code was used to replace a loop, so a loop is out. I have thought about a switch statement, but it seems that I would have to have just as many if statements to set the integral expression for the switch. Would someone please give me a hint? Thanks.
Matthew Phillips
 
Joel Cochran
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmmmm... what if the number test was part of someMethod...
------------------
I'm a soldier in the NetScape Wars...
Joel
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this posting http://www.javaranch.com/ubb/Forum19/HTML/000531.html
Good luck
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the assistance. It's getting to the point where I can't see the little things with Say. I have been looking at it for entirely too long. Hopefully these hints will get me over the hump.
Matthew Phillips
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My wife always says, walk away from it, wise little creature
 
Carol Murphy
village idiot
Bartender
Posts: 1203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, but she forgot about the ending which goes like this:
...and when it's not looking, kick it in the rear and then run!
 
Carol Murphy
village idiot
Bartender
Posts: 1203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seriously Matthew, on some of my previous nightmares- uh I mean assignments, I found that scratching everything and starting fresh opened up a whole new vista, where I could get a glimpse of where I wanted to be!
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually she never did
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thing that has kept me trudging along with Say has been the knowledge that I will learn something in the end and doing a little working ahead on the assignments. When I implemented the suggestions from the replies I finally saw why this method is more simple than the loop I had previously. Now that I have seen that my perspective of Say has been refreshed, although I still want to kick it in the butt while it's not looking.
Matthew Phillips
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wait till you get the instructor's solution and it kicks back
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic