Results 1 to 2 of 2
Thread: How to Write this if statement?
- 01-14-2009, 06:57 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 22
- Rep Power
- 0
How to Write this if statement?
5X2 table:
M1 | M2 | M3 | M4 | M5
MC1|MC2|MC3|MC4|MC5
I've been thinking for the past 2 hrs. I thought of this, please correct me if i'm wrong;
mc1 will compare with m1, m2, m3, m4, m5. If none of m1-m5 is bigger than mc1, then mc1 will be put aside into a variable call ma (memory unallocated)
ignore compareMem1-5 for now. I'm using it to compare which has the largest difference among all of them.
Java Code:if(MC1<M1) { compareMem1=M1-MC1; } if(MC1<M2) { compareMem2=M2-MC1; } if(MC1<M3) { compareMem3=M3-MC1; } if(MC1<M4) { compareMem4=M4-MC1; } if(MC1<M5) { compareMem5=M5-MC1; } else { MC1=MA1; }Last edited by PeterFeng; 01-14-2009 at 07:01 AM.
- 01-14-2009, 07:11 AM #2
directed acyclic graph
I am still not up to needed skills on this but ( hoping a few comments help ) I bought a two volume set "Algorithms in Java" by Robert Sedgewick, the work is reamarkably well written for understanding and plain language. What you are doing resolves to "Trees" - a common computer science concept. The way you are going about it needs a return statement on each conditional + can be re-thought as putting the values in an array or collection, then writing a for( ; ; ) construct, which as I remember will accept a break; on condition true / false.....many computer science issues here, directed acyclic graph == no shortage of nomenclature or previous work available from the college professors.
Try the aussie's first, they seem to be better at computer science than anything else I have found.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Similar Threads
-
if statement help please!!
By soc86 in forum New To JavaReplies: 5Last Post: 12-02-2008, 02:56 PM -
If statement, please help??
By soc86 in forum New To JavaReplies: 5Last Post: 11-23-2008, 02:58 PM -
Help with if statement
By carl in forum New To JavaReplies: 1Last Post: 08-06-2007, 07:53 AM -
Statement or Prepared Statement ?
By paty in forum JDBCReplies: 3Last Post: 08-01-2007, 04:45 PM -
If Statement
By aDrizzle in forum New To JavaReplies: 4Last Post: 07-08-2007, 08:55 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks