- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 358
- Posts with Upvotes
- 282
- Upvoting Members
- 128
- Downvotes Received
- 56
- Posts with Downvotes
- 47
- Downvoting Members
- 36
1,678 Posted Topics
Re: "It requires a very unusual mind to undertake the analysis of the obvious" -Alfred North Whitehead | |
Re: [QUOTE=MosaicFuneral;869504]Coffee, all day, a whole pot. The only real American food is corn dishes. I think, I'm going to be real American, today, and break-out the corncob pipe.[/QUOTE] If a big, fat, juicy hamburger isn't American then I don't know what is. | |
Re: How so? Please post your solution so that if someone comes across your thread in a search (or is just reading the thread like I am) they can see it. | |
Re: ^ No, that is not what he wanted. He just wants any 0's to be removed from the array. I thought I already answered this in another thread last week but in any case it's pretty simple so I don't understand why all of you guys are making it seem … | |
Re: For what it's worth I agree with Masijade (about learning to code GUIs by hand first, then moving on to builders if you want to). Doing so was very helpful to me and it made it a lot easier to use the GUI builder as well. If you jump into … | |
Re: else if (Balance <100) Balance = 0; count = count +1; System.out.println("Balance at Month " +count+ " is " +Balance+ " after making a payment of " +MonthlyRepayment ); That's because you set MonthlyRepayment to 100 initially and then you never set the variable to anything else. If you want … | |
Re: I'd be willing to bet that if you changed your code to this, then your code would work. I've never actually seen somebody use "File" as an argument to a Scanner, so excuse me if I'm wrong, but I don't think it should be used. File is a class that … | |
Re: [QUOTE=Radhika...;1012475]sum=0; for(i=0;i<n;i++) for(j=0;j<i;j++) sum++; what is the actual running time of this code??[/QUOTE] Not positive, but it's probably theta (n * n!) = theta (n^2). The reason I'd say that is because the outer loop is O(n) and the inner loop is always one less than whatever the value is … | |
Re: Error check your code and tell us at what point your code doesn't work and show us the method where it doesn't work. If you can't do that then you won't get any help. | |
Re: And the unofficial way would be to put the code in a method, then call the method in the appropriate places. | |
Re: The person who posted above me is completely wrong. Assembly is faster than any other code if you use/code it correctly. It could be that the optimizations the compiler made for the C++ code were good optimizations, whereas the code you wrote was poorly designed and written. | |
Re: I don't see why you need a DecimalFormat, I don't think it is necessary. And what is your question? | |
Re: The reason it gives you trouble is because when the user enters an integer then hits enter, two things have just been entered - the integer and a "newline" which is \n. The method you are calling, "nextInt", only reads in the integer, which leaves the newline in the input … | |
Re: As for S.o.S's reply, you would expect it to infinitely loop, since you want to continuously check the file for updates. In other words it is supposed to infinitely loop so I don't see why you have an issue with that. Maybe I didn't understand the issue. Anyway, I'll give … | |
![]() | Re: [url]http://www.csee.umbc.edu/courses/undergraduate/341/spring09/projects/proj5/HuffmanExplanation.html[/url] Is that helpful at all? One of the projects I did in school. I don't know if that is "static" huffman coding or adaptive... I always assumed it was the only huffman coding TBH. |
Re: Routers can use queues. I'd elaborate but if you want to use it as an example, it'll force you to research it first to figure out the correct terminology/phrasing for an example. | |
Re: Einstein couldn't speak fluently when he was nine. His parents thought he might be retarded. | |
Re: It looks ok to me. Pseudocode doesn't really have a "standard" format (that I know of) - if an experienced programmer were writing that pseudocode, it would look a bit different - but I think you covered most of the steps, which is the important thing. A program wouldn't just … | |
Re: If you define a method as taking an int parameter (which is how your AccelerateSpeed() method is defined) you need to pass it an int when you call the method. And if you re-read James' post, he was saying that you have a variable 'speed' declared at the class level … | |
Re: For your add (should be called insert?) method: 1. You have to first figure out what index they want to add the item at. If the index they want to add the item at is the empty, then just insert it and you're done. 2. If the index is not … | |
Re: Make a new thread. Ask your question in it. | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html[/url] Read through that tutorial, it should be helpful to you. Courtesy of a post by peter budo that I found by searching daniweb. | |
Re: Maybe I am overlooking the obvious, but why can't you use the depth property to help you test for an AVL tree? | |
Re: Nice first post. Hope you have a good time with that program that the OP said doesn't work that was written years ago. | |
Re: [URL="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileWriter.html#FileWriter(java.io.File,%20boolean"]Putting text at the end of an existing file[/URL] ^ I'm pretty sure using FileWriter with the constructor that has "append" as one of the arguments will allow you to write to a file without deleting its contents first. To use FileWriter: PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out"))); [URL="http://java.sun.com/j2se/1.5.0/docs/api/java/io/BufferedWriter.html"]The … | |
Re: JW1234: Binary code and machine code are the same thing. | |
Re: You should validate the employee's salary in the employee's module (i.e. the employee module should not exit until they have entered a valid salary). Same for the other modules. It makes the "main" part of your pseudocode more concise, and leaves the obvious tasks to the modules that they belong … | |
![]() | Re: I don't know what line 12 is because you didn't use the code tags correctly. If you had, it would have put line numbers there. Anyway: Check out the String class's toCharArray() method. Once you get your char array, iterate backwards over it, printing out each character. If you want … |
Re: Yes. In your "main package" you can add a folder called resources. In that resources folder you can put your files. Then you can export the project as a Runnable Jar File in eclipse by going to File->Export->(Choose Java Option)->Runnable Jar File. Here is a code sample to get you … | |
Re: What part of your code isn't working? Your code should be split into pieces/methods that each perform a specific task. You should be able to identify where the code isn't behaving as expected, either with a debugger or just by using print statements. Tell us where your code doesn't work, … | |
Re: [url]http://beej.us/guide/bgnet/output/html/multipage/index.html[/url] The above is the one my computer networks class used. I don't know how good it is compared to other guides, but it was good enough for me to get my projects working (with a little help from the fine members here :) ). | |
Re: If you want to use that code, I'd suggest you simply copy and paste it into another file, and edit it so that it sends its output to a text file rather than prints it on the screen. You can use PrintWriter to do this. | |
Re: If you expect a solution, please post the exact error code you are getting. It usually includes line numbers and method names, etc. | |
Re: Probably, do a google search for them. If you're talking about simple differentiation and integration (i.e. power rule) then it is trivial anyway, and so is chain rule for differentiation. Why don't you mention the specific formula you're trying to code and then show some progress or ideas etc on … | |
Re: Steps to do your project: 1. Make a main class (You've already done this and posted it). 2. Make a class called Word. 3. The 'Word' class should have two instance variables: 'String theWord' and 'int count'. The 'Word' class should have a constructor that takes a String and an … | |
Re: http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html#select See the section on "Responding to node selection". When the selection changes, get the selection and use the JFileChooser's setSelectedFile method to set it accordingly. | |
Re: You should change your getHighestInRow method to take two parameters: The row number that you want to get the highest value of, and the array itself. Then in your main method you can use a for loop to loop over each row of the array, getting the highest of each … | |
Re: Use your brain. This problem is practically begging you to have some level of intelligent thought. They didn't even ask for programming examples, they just asked for [I]examples[/I]. Are you really that dumb.. ? | |
Re: [CODE] //In a file called First.java public class First{ ... } [/CODE] [CODE] //File called Second.java public class Second{ .. main(){ First f = new First(); } } [/CODE] Put the classes in a package together... then you can create a new Object and use the class's methods. | |
Re: It happens because changing the size of the column indirectly causes the layout() method to be called on your widget. In order to dynamically insert data into the table, you could just call layout() on the table after you add the data. Then you won't need to reset the column … | |
Since I keep seeing people asking how to read the Integers from a File, I figured this simple snippet might be useful. What it does is it creates a new Scanner Object based on the File Object "test.txt" then it reads all of the Integers from that file, skipping over … | |
Re: [url]http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html#read%28%29[/url] [CODE]char c = (char)buffReader.read();[/CODE] | |
Re: I don't understand the second half of your explanation, so hopefully this is useful to you. File class: [url]http://java.sun.com/javase/6/docs/api/java/io/File.html[/url] For example you can easily create a new file using the createNewFile method. There are plenty of useful methods in there. | |
Re: Umm you need a dynamic programming algorithm that uses subproblems and memoization to solve this adequately. Pretty sure all of the "solutions" listed in here are wrong. | |
Re: Code snippets should be posted for working code, post a regular thread for questions in the future. | |
Re: Hey, Sean. Good to have you here. So what languages do you like? What are you interests as far as programming? Desktop or web oriented? | |
Re: Your question pertains to computer science in general more than it does to java, maybe you should try posting in that forum? |
The End.