Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Error trapping without loops
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
evogre3n




PostPosted: Sun Oct 30, 2005 12:15 pm   Post subject: Error trapping without loops

Hey all,

I have a simple if structure assignment to prove I know how to use it properly etc.

THe problem is im not allowed to use any kind of loop for error trapping.

And if I have 4 inputs lets say..

Input 1 --> correct
Input 2 --> correct
Input 3 --> WRONG try again
Input 4 --> null

If i enter the wrong input at the 3rd input, I dont want it to go back to the very first input and ask it again (so calling the method in the if structure is out of the question)

Any help on this?

Thanks a lot!
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sun Oct 30, 2005 12:29 pm   Post subject: (No subject)

Recursion with two methods?

code:
[Step 1]
   |
   |
   |
   |
   |
   V
[Step 2]<--+
   |       |
   |     wrong
   V       |
[Input ]---+
   |
   |
   V
[ Done ]
MysticVegeta




PostPosted: Mon Oct 31, 2005 6:39 pm   Post subject: (No subject)

yeah recursion is the way to go, call a void inside that void, (they call a procedure a void in java, dont they?) C++ is better i think just call the void like
code:
void calculate {}
instead of having to go public static void and then going System.out.println("x") lol

anyways, yeah recursion, if you dont know ask miss dyke.
evogre3n




PostPosted: Tue Nov 01, 2005 8:14 pm   Post subject: (No subject)

ya i figured it out guys, thanks anyways
beard0




PostPosted: Wed Nov 02, 2005 3:24 pm   Post subject: (No subject)

MysticVegeta wrote:
they call a procedure a void in java, dont they?


No the name for procedures/functions in java is method. A method is declared useing the type (i.e. int, float...) of its result. So a procdure (a function which doesn't return anything) returns the special type void, and so you declare the java equivalent of a procedure using the keyword void, which is a data type, and not the method itself.
MysticVegeta




PostPosted: Thu Nov 03, 2005 7:39 pm   Post subject: (No subject)

Is it called a method in C++ too? I usually use the functions, rarely encounter the void methods Confused
wtd




PostPosted: Thu Nov 03, 2005 8:39 pm   Post subject: (No subject)

C++ has "functions", not "methods".
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: