Results 1 to 10 of 10
- 01-15-2009, 10:15 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 3
- Rep Power
- 0
- 01-15-2009, 10:28 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What you exactly want to do in this way.x = 5;
x = x + 2;
// Get the first value and set back the value to 5
x = 5;
x = x + 3;
// Get the next and do the same
x = 5;
x = x + 10;
// Get the next
- 01-15-2009, 10:34 AM #3
Member
- Join Date
- Jan 2009
- Posts
- 3
- Rep Power
- 0
condition is decided by the user as input:
based on the users selection the program gives the output:
prior to user selection i want to know what all values can x take if the program execution is done in all possible ways:
that is i need to get an array of values that x can take if it cond1 is satisfied or something like that
- 01-15-2009, 05:04 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Just see your logic. You cannot access more than one condition at a time in the if-else statements. So how can you evaluate all possible values like this?
- 01-15-2009, 05:31 PM #5
do you mean somehting like this??
what kind of condition are you thinking of?Java Code:int x=5; if(cond1) x=x + 2; else if(cond2) x=x + 3; else x=x+10;
if its simple add/sub, you can prob write some code like:
if args[0] == '+' do this ...
- 01-15-2009, 08:47 PM #6
hhhmmm...
I think the OP wants something like this:
THe only way I can think to do it is execute each of the values and then go therough the conditionals.The possible values that can be obtained are: 5,6,7 & 2398
Value obtained using user's condition is: 7
Make sense? Why it's needed that way, I don't knowJava Code:x=5; x1=x + 2; x2=x + 3; x3=x+10; if(cond1) x=x + 2; if(cond2) x=x + 3; else x=x+10; print out x1, x2 & x3 and then print x.
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 01-16-2009, 02:09 AM #7
Senior Member
- Join Date
- Jan 2009
- Posts
- 119
- Rep Power
- 0
Can you confirm if I got your problem correctly?
The problem is you want to generate all the possible value that the user keys in and have already prepared solutions (or number maybe) so that it prints out the result when the number is keyed in.
- 01-19-2009, 09:11 AM #8
Member
- Join Date
- Jan 2009
- Posts
- 3
- Rep Power
- 0
What I exactly need to do is .....
I need to get all the values that a variable can take and safe it into an array before running the program.
and then check the probability of occurrence of each output when the program is run normally.
the input to my program can be any java file and the output should contain the array of values a particular variable can take in different conditions?
- 01-19-2009, 01:09 PM #9
OK... where's the code..
Various people have tried to undertand your problem and have suggested a couple of ideas. So far, we haven't seen any code from you... what are you waiting for? Have you tried to code something?
Show us what you have done.
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 01-20-2009, 02:35 AM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
In every explanation he described different things I guess. May be he's looking some code from us, without putting any effort.
Similar Threads
-
Retaining DB values as well as Dynamically generated Values.. Help Needed !
By rajivjha in forum Advanced JavaReplies: 0Last Post: 05-22-2008, 10:53 AM -
Accessing boolean Values of another values in one class.
By a_iyer20 in forum Advanced JavaReplies: 4Last Post: 04-15-2008, 01:04 PM -
getting the value of variable
By Lehane_9 in forum New To JavaReplies: 2Last Post: 03-05-2008, 01:42 AM -
Getting variable value from a variable name
By Java Tip in forum Java TipReplies: 0Last Post: 02-16-2008, 09:26 PM -
How to get variable values at runtime in another process
By murali_java in forum Advanced JavaReplies: 0Last Post: 11-02-2007, 08:03 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks