Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Cattle Drive and the fly likes Java-4b Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Java-4b" Watch "Java-4b" New topic
Author

Java-4b

Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
okay, i know this one has been discussed to death, but i have a new question.
i tried not to read the previous posts because i did not want to spoil my learning experience... but i did notice some people talking about switch statements.
i wrote it last night using 4 methods ( plus main() ) that use if/else statements. one of the functions is recursive, and calls the other functions as necessary...
i am just curious if i am heading in the right direction with this one. anyone out there who has passed 4b using what i have described? it seems too easy, so i am sure i did something wrong!


what?
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I believe the real key is to use as few if statements as possible. Placement is the key.
Matthew Phillips

Matthew Phillips
Rick Prevett
Ranch Hand

Joined: Apr 16, 2001
Posts: 68
I used a function (the function type started with an 'r' ), and I was nitpicked. If you want to read the nitpick, submit the function, but I didn't pass using it.
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
thanks for the tips... i just noticed that c++ was trying to come out in my post above i said "methods" the first time, but then i digressed to "functions"... i cannot get away from it!
 
 
subject: Java-4b