Results 1 to 15 of 15
Thread: Int equals void
 05052010, 03:08 PM #1Member
 Join Date
 Mar 2010
 Posts
 14
 Rep Power
 0
Int equals void
I am building a applet that can read inputs from the user to make codons for DNA, so my teacher can use it. It reads the first three characters to make a codon, uses those characters to get a value (1, 2, 3 or 4), takes those character values to make a codon value (1  64), and then changes that codon value into the Amino Acid name. I am trying to take this int value, called codonNumber, and make it equal a different number, called from a void called getCodon. Can anyone help me? This is my error:
Java Code:/tmp/jc_20900/DNA.java:144: getCodon(int) in DNA cannot be applied to () codonNumber = getCodon(); ^ 1 error
Java Code:if(firstInput != 0 && secondInput != 0 && thirdInput != 0) { codonNumber = getCodon(); } } public static void getCodon(int codonNumber){ if(firstInput == 1) { if(secondInput == 1) { if(thirdInput == 1) { codonNumber = 1; } else if(thirdInput == 2) { codonNumber = 2; } else if(thirdInput == 3) { codonNumber = 3; } else if(thirdInput == 4) { codonNumber = 4; } } else if(secondInput == 2) { if(thirdInput == 1) { codonNumber = 5; } else if(thirdInput == 2) { codonNumber = 6; } else if(thirdInput == 3) { codonNumber = 7; } else if(thirdInput == 4) { codonNumber = 8; } } else if(secondInput == 3) { if(thirdInput == 1) { codonNumber = 9; } else if(thirdInput == 2) { codonNumber = 10; } else if(thirdInput == 3) { codonNumber = 11; } else if(thirdInput == 4) { codonNumber = 12; } } else if(secondInput == 4) { if(thirdInput == 1) { codonNumber = 13; } else if(thirdInput == 2) { codonNumber = 14; } else if(thirdInput == 3) { codonNumber = 15; } else if(thirdInput == 4) { codonNumber = 16; } } } else if(firstInput == 2) { if(secondInput == 1) { if(thirdInput == 1) { codonNumber = 17; } else if(thirdInput == 2) { codonNumber = 18; } else if(thirdInput == 3) { codonNumber = 19; } else if(thirdInput == 4) { codonNumber = 20; } } else if(secondInput == 2) { if(thirdInput == 1) { codonNumber = 21; } else if(thirdInput == 2) { codonNumber = 22; } else if(thirdInput == 3) { codonNumber = 23; } else if(thirdInput == 4) { codonNumber = 24; } } else if(secondInput == 3) { if(thirdInput == 1) { codonNumber = 25; } else if(thirdInput == 2) { codonNumber = 26; } else if(thirdInput == 3) { codonNumber = 27; } else if(thirdInput == 4) { codonNumber = 28; } } else if(secondInput == 4) { if(thirdInput == 1) { codonNumber = 29; } else if(thirdInput == 2) { codonNumber = 30; } else if(thirdInput == 3) { codonNumber = 31; } else if(thirdInput == 4) { codonNumber = 32; } } } else if(firstInput == 3) { if(secondInput == 1) { if(thirdInput == 1) { codonNumber = 33; } else if(thirdInput == 2) { codonNumber = 34; } else if(thirdInput == 3) { codonNumber = 35; } else if(thirdInput == 4) { codonNumber = 36; } } else if(secondInput == 2) { if(thirdInput == 1) { codonNumber = 37; } else if(thirdInput == 2) { codonNumber = 38; } else if(thirdInput == 3) { codonNumber = 39; } else if(thirdInput == 4) { codonNumber = 40; } } else if(secondInput == 3) { if(thirdInput == 1) { codonNumber = 41; } else if(thirdInput == 2) { codonNumber = 42; } else if(thirdInput == 3) { codonNumber = 43; } else if(thirdInput == 4) { codonNumber = 44; } } else if(secondInput == 4) { if(thirdInput == 1) { codonNumber = 45; } else if(thirdInput == 2) { codonNumber = 46; } else if(thirdInput == 3) { codonNumber = 47; } else if(thirdInput == 4) { codonNumber = 48; } } } else if(firstInput == 4) { if(secondInput == 1) { if(thirdInput == 1) { codonNumber = 49; } else if(thirdInput == 2) { codonNumber = 50; } else if(thirdInput == 3) { codonNumber = 51; } else if(thirdInput == 4) { codonNumber = 52; } } else if(secondInput == 2) { if(thirdInput == 1) { codonNumber = 53; } else if(thirdInput == 2) { codonNumber = 54; } else if(thirdInput == 3) { codonNumber = 55; } else if(thirdInput == 4) { codonNumber = 56; } } else if(secondInput == 3) { if(thirdInput == 1) { codonNumber = 57; } else if(thirdInput == 2) { codonNumber = 58; } else if(thirdInput == 3) { codonNumber = 59; } else if(thirdInput == 4) { codonNumber = 60; } } else if(secondInput == 4) { if(thirdInput == 1) { codonNumber = 61; } else if(thirdInput == 2) { codonNumber = 62; } else if(thirdInput == 3) { codonNumber = 63; } else if(thirdInput == 4) { codonNumber = 64; } } } }
 05052010, 03:13 PM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,394
 Blog Entries
 7
 Rep Power
 25
 05052010, 03:18 PM #3
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,394
 Blog Entries
 7
 Rep Power
 25
Am I right that the codon number equals:
16*(firstInput1)+4*(secondInput1)+thirdInput?
kind regards,
Jos
 05052010, 04:17 PM #4Member
 Join Date
 Mar 2010
 Posts
 14
 Rep Power
 0
Ummmmmm, no. Lol. That isn't how I had the formula. I think I know how to fix it now.
 05052010, 04:42 PM #5
Uhm, I think this is close to what you need:
Java Code:String s4 = String.valueOf(firstInput 1) + String.valueOf(secondInput 1) + String.valueOf(thirdInput 1); codonNumber = Integer.parseInt(s4, 4) +1;
Math problems? Call 1800[(10x)(13i)^2][sin(xy)/2.362x]
The Ubiquitous Newbie Tips
 05052010, 04:48 PM #6
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,394
 Blog Entries
 7
 Rep Power
 25
 05052010, 04:51 PM #7Math problems? Call 1800[(10x)(13i)^2][sin(xy)/2.362x]
The Ubiquitous Newbie Tips
 05052010, 04:53 PM #8
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,394
 Blog Entries
 7
 Rep Power
 25
 05052010, 04:58 PM #9
Aye sir, off to the quarry.
Math problems? Call 1800[(10x)(13i)^2][sin(xy)/2.362x]
The Ubiquitous Newbie Tips
 05052010, 05:12 PM #10
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,394
 Blog Entries
 7
 Rep Power
 25
 05052010, 06:10 PM #11Moderator
 Join Date
 Apr 2009
 Posts
 13,234
 Rep Power
 23
 05052010, 06:17 PM #12
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,394
 Blog Entries
 7
 Rep Power
 25
Oh great, I don't pay attention for one meager minute and they sort it all out behind my back, it's not fair! What'd happen if I started to sort things out behind their backs? Hm? That's what I'm all about, it's not fair! So there.
kind regards,
Jos (< staring at the folks with the syringes and their white coats ... ;)
 05062010, 03:33 PM #13Member
 Join Date
 Mar 2010
 Posts
 14
 Rep Power
 0
Lol thanks guys for posting. I just called the void instead of making the getCodon equal the void. I mean, if you looked inside the getCodon method, you could see that it would already happen. =p Now I have to make Jmenu buttons with actions, so commands like "Transcribe" and "Translate" will work. Any help with that would be nice, or just send a URL of where it could teach it noob friendly.
 05062010, 03:38 PM #14Moderator
 Join Date
 Apr 2009
 Posts
 13,234
 Rep Power
 23
Well, in the original posted code your codonNumber might be being set in the method, but it's not being past out. For example this call:
Java Code:int codonNumber = 0; getCodon(codonNumber);
 05062010, 03:44 PM #15Member
 Join Date
 Mar 2010
 Posts
 14
 Rep Power
 0
Similar Threads

'void' type not allowed here
By Torgero in forum New To JavaReplies: 15Last Post: 10042008, 11:08 PM 
name clash: equals(E) in and equals(java.lang.Object)
By AdRock in forum New To JavaReplies: 0Last Post: 01262008, 12:13 AM 
The different of static void,protected,and void in methods?
By Winarto in forum New To JavaReplies: 5Last Post: 01252008, 12:53 AM 
is void a type?
By mary in forum New To JavaReplies: 3Last Post: 08012007, 08:12 PM
Bookmarks