2,040 Posted Topics
Re: @strongguy12345, You need to be careful not to give away the solution code. This forum is not for getting solution code but to help other understands what their problem and may give hints to the solution. Giving partial code for the solution is fine as well. However, what you did … | |
Re: You could do 2 things - hard code or have default variables as constants. I would use hard-coded for now. Which way do you prefer? | |
Re: You mean to run it? I think Linux already has its built-in file permission system (which is much better than Windows). If you want, you could set up a group permission for the file and add any user you allow to use it into the group. Then in your Java, … | |
Re: Hmm... I'm wrong. You could change the ID, but it is not a good idea. You could, however, clone the element and reassign a new ID, then remove the old element and add the new element to the same place. Well, if you want, you could actually use document.getElementById(elementID) instead … | |
Re: I could do it using eval() function; however it is a really bad design to create it dynamically. You will have a hard time maintenance your script and other things else in the future. Use array to hold on your data instead of create new variable each time... | |
Re: OK, do you mean the "right hand rule" is that the robot will always turn right if it can turn right? Or it should try to go through the maze by hugging the wall on the right all the time? If it is the first meaning, it will be very … | |
Re: Look at the API again, saw that the way you create ArrayList is not fit your use. [URL="http://download.oracle.com/javase/6/docs/api/"]http://download.oracle.com/javase/6/docs/api/[/URL] OK, the problem with declaring with no type will result in warning when you compile because you do not check for the raw type. Another big problem is that you have NO … | |
Re: 1)Please use "code" tag next time. 2)How do you define "compute the edit distance between these two files"? What does this mean? Could you give an example? 3)How big each file is? Are you sure that an array size of 3000 would be able to hold all cases? | |
Re: Your logic of condition is not correct. You are checking the different, not the comparison. It should be... [CODE] else if (guess2!=randomNumber && (Math.abs(guess2-randomNumber)<Math.abs(guess1-randomNumber))) { System.out.println("The number was: "+randomNumber + " ." + " Your second guess was closer."); } [/CODE] However, the design of the program is too much … | |
![]() | Re: Hmm... I don't know why you need "Cookies" to do the show/hide here? You could simply check whether the checkbox value is checked or not to do the show/hide. Also, you need a separate script to add new checkbox elements. Do you know how to use document.createElement(TagName)? ![]() |
Re: Nope. I don't know what actually causes the error in line 18 and 33. I have no idea what the script is trying to call and got an error of index not found... | |
Re: 1.You need a loop to do the roll. Currently, you only roll it once and done. 2.You do not have the display part for the value you just row. 3.What does your line 16 [icode]Die(sides)[/icode] do? The "sides" variable is unknown in the function. If you want to create a … | |
Re: If you must use JavaScript to create, then you may use Cookies to keep the variables needed to mark the state of creation. If you read it from the database, you simply reread the data from the database when you render the HTML. | |
Re: When I saw the topic, it was about copying. But I am not sure that what you mean after I saw your comment about dereferencing array. Do you want the maze value inside Robot class to be automatically changed when the maze value changed after the maze values are copied … | |
Re: You are on the right track. You just need to reverse how your loop goes. Look at your inner loop. [CODE] for (int c = 1; c <= size; c++) [/CODE] If you reverse it from [B]incremental[/B] loop value to [B]decremental[/B] loop value with the range from (size-1) to 0 … | |
Re: The problem is from the bug you introduce in line 58 & 59 as well. When you find the smallest node, you add the node to the new list WITHOUT copying but use the object reference (look at your Node class line 8). Then you modify the node you just … | |
Re: You've already defined the "i" in [code]int i = kbReader.nextInt( );[/code] So you cannot declare it again in for loop as [code]for(int i = 100; i <= 999; i++)[/code] | |
Re: OK, you are implementing a Big int using array list... You may encounter the most difficult part of this assignment in implementation when you hit division. :P Anyway, back to adding and multiplying. First you need the addition to work in order to go on multiplication. To add, you simply … | |
Re: Instead of [CODE]if(isPalindrome = false)[/CODE] Change it to [CODE]if(isPalindrome == false)[/CODE] because "=" means you assign the value to the variable while "==" means comparing the value with the variable. However You could do [CODE]if(!isPalindrome)[/CODE] because it is a boolean and you could use it right away as "true" or … | |
Re: You may need to add classpath parameter for the jar file when you compile. | |
Re: What first, second, third, variable for? You are NOT returning "third" but first+second even though you assigned value to "third" in your checking? You need to modify some in your codes... 1)Change all "third" variable name to "second" in line 43 to 50. 2)Move your code line 52 to 60 … | |
Re: Unfortunately, there are so many and could depend on different situation & topic. You may not just keep only one algorithm and discard all others because there could be a situation when one of the others is better than the one you keep. This question is too broad... | |
Re: As JeffGrigg said, how would you relate the deliver() of a Person class with the BikeRack class (3rd code portion)? The rack will never be full? I also do not see anything wrong with other deliver part. I am not sure how you do the rental part? That may be … | |
Re: And what are your errors? I would rather see the code posted here instead of download your files... | |
Re: The OP posted one earlier with the same code. Anyway, I think I got what the OP wants. He/she wants to add the part that the program asks user to enter a color value. Then apply the color to the applet background... The code is on the right track, but … | |
Re: Hmm... ObjectElement.setText(""); where the ObjectElement is the text field??? Of course, that means you are using actionPerformed() to listen to the click event of the button. | |
Re: [QUOTE]And the right way to call a 'setTimeout()' is: 'setTimeout( funcName, millis )'. Note that 'funcName' is not followed by parens and is not enclosed in quotes.[/QUOTE] It is OK to call setTimeout function with quote -- setTimeout("func()", time) and should not get an error. You could also pass the … ![]() | |
Re: [CODE]Assert.assertEquals("523.5987755982989", sphere.getVolume(5));[/CODE] Equal means equal, but double/float value is an estimate. As a result, the different value could occurs at the level of epsilon. What you need to do is to give a margin of error for computation. If it is double, give it a 1x10^-10 or so. | |
Re: Hmm... Are you sure that the quote is in the way you are showing? The reason is that it would be an error on HTML because there can't be double quote inside double quote that way??? | |
Re: Are you sure that you need to find for each number from 1 to 1000??? I know that any starting number will eventually reach "1" at the end of computation. Anyway, line 17 should be "else" instead of "if" alone. | |
Re: In your 2nd code, you did it correctly to use a loop, but there are a couple things you need to do with it. 1)You are hard-coded and expect that user will always enter a 5 digit number. As a result, whenever a user enters any string length less than … ![]() | |
Re: Please do not hijack old post... Also, how did you use your command line to run it? How did you compile your code? | |
Re: Please use "code" tag next time... Here is my pure JavaScript version. [CODE] <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Scroller example - jsFiddle demo</title> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script> <link rel="stylesheet" type="text/css" href="/css/result-light.css"> <style type='text/css'> body { width: 960px; } #mainbar { width: 660px; float: left; } #sidebar { width: … | |
Re: OK, I do not have the total idea of how to do it because I have questions about your assignment. Do you have to handle parenthesis as well? Or the user must modify the way of entering the input? [CODE] //i.e. // notice it is not -- (not P -> … | |
Re: GK2011, please do not hijack old post. This post is 2 years old! Please create a new thread if you are going to ask a question. You may add a link back to old posts if you want to in order to relate your subject to the post. Anyway, do … | |
Re: Depends on how you define your class variable. If you define it as "private" then you must provide a method to access the variable. [CODE] class ClassA { private double a; ... // must provide the access methods public double getA() { return a; } // need this and look … | |
Re: Yes, you could attempt to detect a browser; however, the best way is to redesign and apply Cascade Style Sheet (CSS) to your web page. All major browsers normally follow the CSS rules. Even though there could be some differences (i.e. older IE browser versions and maybe the current version … | |
Re: Can you test it with a simple Java Script call using [CODE]window.open('sitemap.php','SiteMap','width=640,height=480')[/CODE] to see whether or not IE pop up a new window correctly. If so, then it is the script inside MM_openBrWindow() function that may not be compatible with IE. | |
Re: The equation should be wage = wage * (1+(raiseMoney/100)); | |
Re: Do you want to display the whole complete Venn diagram? If so, you would need Graphics or Graphic2D to draw the diagram for you. If you want it to be dynamic, you need to redraw (paint) the panel over again once you get a value and computed. | |
Re: Your code is an incomplete code. 1)You have a class "TestClassNumber" with no constructor, but you attempt to create the class instance with a constructor passing in a string? [CODE] public class TestClassNumber { public static void main(String[] args) { ... TestClassNumber sr = new TestClassNumber (series); // HERE? ... … | |
Re: If I remember correctly, atan() takes radiant value, not degree. The atan2() takes the diff of y and diff of x (y2-y1, x2-x1). | |
Re: OK, here is some info from oracle website for overload. [URL="http://download.oracle.com/javase/tutorial/java/javaOO/methods.html"]http://download.oracle.com/javase/tutorial/java/javaOO/methods.html[/URL] [QUOTE]Overloading Methods The Java programming language supports overloading methods, and Java can distinguish between methods with different method signatures. This means that methods within a class can have the same name if they have different parameter lists (there are … | |
Re: One more thing... Line 16 in your collection class... [CODE]for(char option = 'Y'; option == 'Y';){[/CODE] What's this for??? | |
Re: [QUOTE]please tell me what the problem .[/QUOTE] I thought you would tell me what the problem you are experiencing instead of ask me to look through all of your code and try to figure out what it is??? OK, look at this link [URL="http://www.javacoffeebreak.com/faq/faq0052.html"]http://www.javacoffeebreak.com/faq/faq0052.html[/URL]... It may be what you are … | |
Re: Well, I am a Ruby on Rails (RoR) developer and I do Ruby & Perl scripts as well to assist the background work that Rails cannot do. I also did PHP about 5~6 years ago for about a year. If you are going to compare Ruby and PHP, you should … | |
Re: Yes. [CODE] <html> <head> <script type="text/javascript"> function checkSel2(sel1Obj, sel2Id) { var sel2Obj = document.getElementById(sel2Id) if (sel1Obj && sel2Obj) { // loosely check for existence if (sel2Obj.selectedIndex<=sel1Obj.selectedIndex && sel1Obj.value<16) { // not at the last option sel2Obj.selectedIndex = sel1Obj.selectedIndex+1 } else if (sel1Obj.value==16) { // last option in select sel2Obj.selectedIndex = … | |
Re: You are using variables without initializing them. You need to initial the value of avg_temp_hi and avg_temp_lo to 0 before you use them in the loops... | |
Re: [QUOTE]What I understand is that the algorithm should traverse through the whole tree and return all entries with the same key. [/QUOTE] Not sure that is a correct assumption. It does not traverse through the whole tree but only the branch of the tree it should go. OK, what is … |
The End.