1,678 Posted Topics
Re: It doesn't seem like your maxHeapify method has a base case. Meaning, even when it finds the values you are looking for, it will keep looking for those values. You need a base case so that once the method finds what its looking for, it no longer continues calling itself. … | |
Re: In case this is helpful (for what you mentioned above) //By default, can get input typed from the keyboard //This would change if System.in was redirected Scanner keyboard = new Scanner(System.in); //Get input from a file Scanner fileInput = new Scanner(new FileInputStream("yourFile.txt")); Also, following up on what S.o.s said, keep … | |
Re: loop through each index of the array{ loop from 0 to the number at the current index of the array - 1{ print the star } } For the first loop, consider that you want to print the stars for each index of the array. One way to do this … | |
Re: So you guys are suggesting reading the entire file into Objects and then editing and writing it back out? Seems inefficient to me - there's no better way? I'm sure there's a way to just have a carat position and then write things there. Not saying your way isn't good, … | |
Re: I will write it for you for one milliiiiiiioon dollars (Austin Powers anyone?) | |
I have two programs, one is a GUI and the other is a normal (non GUI) program. How do I make a method in the non-GUI program wait until a JButton on the GUI gets clicked before continuing? (No while loops) This is frustrating since I'm fairly certain somebody here … | |
Re: Just use google. Type System.out.println() java, or you could also try Java IO. Also, an easy way to 'count' would be // X Thread.getThread().sleep(1000); //waits for 1 second. //If you print out right here, you can be sure that the time is extremely close to 1 second from X | |
Re: A stack overflow error is caused when you run out of stack space. Stack overflow error [I]can[/I] mean that you have an infinitely recursive method, since this will cause you to run out of space eventually. The stack is just a block of memory that's made available to your program. … | |
Re: What you posted above doesn't really make sense. Make sure to clearly explain what you mean. On one hand, your thread title makes it seem like you are having trouble reading stuff in from the file. If that is the case, then why are you talking about indexOf()? indexOf() is … | |
Hey, one of you guys suggested that I go on Wikipedia's page for hash tables. It was actually pretty informative. I'm pressed for time so I am doing separate chaining for my hash table because it seems like it will be one of the easiest to implement (and according to … | |
Re: float balance = (float) 0.0; Saying (float) is unnecessary here, the compiler knows you are declaring a float. The 'continue' statements are unnecessary, as far as I know, so you should consider that. (It isn't your problem, I don't think) However, one way to limit down your problem is to … | |
Re: Are you sure you're in the right forum? (I'm not saying you're not - just curious, since I thought this kind of thing was usually php or something) | |
Re: if (SecondIndex == -1) //call method with null params here else //call method with normal params here So you would just do some calculations to figure out if the index is not a valid index. You could do this anywhere you want - I'd recommend a separate method, it keeps … | |
parseInt does not seem to be throwing an exception when I pass a letter of the alphabet to it. I assume this is because ASCII letters are treated as integers. So my question is, is there a method that will do this: boolean isLetter(); And if not, how do I … | |
Re: He's not asking a question, he's asking somebody to do his work for him. Vote- death | |
Re: Just so you know, an Object oriented approach to solving the problem would involve creating a class called Bicycle that had instance variables such as wheelRadius and the other things you listed above. Then, you would have methods - for example, one method might calculate the effective radius. In this … | |
I need to build a hash ADT from scratch. This means no use of any java library methods or classes. Does anyone know of any good resources that will explain how hashing works and how this info is helpful to build one? For example, how find() works, how insert() works, … | |
Re: Seconded on using Sockets. Unless the FTP thing is a requirement of your assignment. Here is where help on using Sockets can be found. [url]http://java.sun.com/docs/books/tutorial/networking/sockets/[/url] | |
Re: If you are simulating lots of circles bouncing off of each other, you would have to compute whether or not they are currently touching/adjacent by giving each circle a radius, and keeping the current position of the circle's center. Then, as the circle bounced, you could do a calculation between … | |
Is there any way that I can take a String and somehow use it as if its the name of one of my declared Objects? For example, if I have an Animal named germanShephard, is there some way I could say String gerSh = "germanShephard"; and then treat gerSh as … | |
Re: [url]http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html[/url] A scanner object is created the same way any other Object is created in Java. If you don't know anything about Objects and how they are created, go read the Java tutorial stickied for this forum. | |
Re: Nobody is going to sift through your code looking for errors. [url]http://java.sun.com/docs/books/tutorial/uiswing/[/url] That tutorial is what helped me gain the skill to write a GUI which handled multiple different activities, including printing, interactivity between itself and other GUIs, updating its information while running (adding text), and updating its main database … | |
Re: First, decide what properties a Bank Account has. For example, a Rectangle has the following properties: height, width, area Once you decide what properties a Bank Account has, create variables in your Bank Account class to represent those properties. Then, create methods to do certain things with those properties. Does … | |
Re: Wait until someone verifies this advice, but back in the day, I did a doubly linked list program. I made the delete function somewhat like you did, and my program didn't work correctly. I think it should be declared as char delete ( ListNodePtr **sPtr, ListNodePtr **tailPtr, char value ) … | |
Re: Here is a code example to answer a few of your questions; [CODE] //This creates a 'Scanner' object that is attached to the keyboard (since System.in) is attached, by default, to the keyboard. To learn how to use your Scanner object (I called it input), google 'Java Scanner' and look … | |
Re: What do you mean? A queue means its FIFO - first item put in the queue is the first item that comes out of the queue. So its not random. | |
Re: From when I programmed in C, I remember that output stream redirection is done by a.out > filename.txt or a.out < filename.txt I don't remember which. One is input redirection, the other is output. I think the first is output. | |
Re: Get rid of the call to pack(). pack() resizes the components based on the preferred size of each component. So either setPreferredSize() and use pack, or leave your code like it is and do not use pack. | |
Re: When you create a Scanner object, you have to do it with an input stream. The name of the file is [I]not[/I] an input stream. Do this. Scanner input = new Scanner(new FileInputStream(fname)); | |
Re: I don't use drag and drop but if I understand you correctly, you're thinking about it the wrong way. When you click and drag it fires events, and certain methods handle those events. Also, read this, it will answer any basic questions you have [url]http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html[/url] | |
I read about data forwarding and according to my notes, a nop (no-op) is required before a beq operation and after a lw operation. What about sw? | |
Re: to do so you have to store it in memory. How do you plan to do this without use of a file? | |
Re: Download 1.5 or higher. Honestly, how hard could it be to find a compiler and JVM? Lol | |
Re: 1. You need to use code tags. Read the rules stickied at the top of the forum. 2. Read this. [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html[/url] | |
Re: What they suggested above isn't your problem (well, it is a problem, but its not your error). Your problem is that you can't name your variable with the class name. Circle Circle is invalid because Circle is the class name. The word after the first Circle should be your variable … | |
Re: Why would you add an unnecessary level of abstraction (creating the structures) if you don't need to? The point of a structure is to group related data, not to shove **** together in order to reduce # of parameters | |
Re: This is just a guess, but I'm somewhat certain that if you don't explicitly call the constructor, the compiler will put in a super() call for you, which calls the default constructor (the constructor with no parameters). Since your Base class does not have a constructor w/ no parameters, that … | |
This is supposed to draw a line through the JButtons when square9 is clicked. It doesn't work but there are no errors and I don't see what the problem is. Ezzaral gave me the code to draw the line earlier. Obviously, the winning squares aren't always diagonal, so I will … | |
I have a TicTacToe board and I need to draw a line through the X's or O's when someone wins. I know how to use the paint method, repaint, etc (as far as how they're called & the basics). I'm just not sure how to go about actually drawing the … | |
Re: A seg fault occurs because you are attempting to access a memory location that is not part of the memory space that you are supposed to be accessing. In other words, you have an error in your program that is causing it to end up in an unallowed memory location. … | |
Re: Yes. I'm not sure how though. :) You can embed languages, and you can also always store the result then access it later. I'm sure someone else will explain much better. | |
Re: I'll help you out, Ezzaral. I voted for the option at the top. I'm still not sure what ugent means, though. *also shrugs* | |
Re: Lol, this kid literally posted his entire assignment and [I]expects[/I] someone to do it for him. Wow. | |
Re: Identify the portion of the code that isn't working and explain what it is supposed to do and I will gladly try to help you. Also, if we're supposed to identify your problem based on that 100 lines of input & output and that small segment of code, how are … | |
Re: Use code tags. Do so by clicking go advanced then clicking the icon at the top. It'll look like this: (And by the way, if you are using a Binary Search Tree, my code may be helpful to you, because at first glance, your code seems to be very wrong. … | |
Re: Are you asking how to add something to an ArrayList? If so, and your ArrayList is called myList, use myList.add(item); where item is what you want to add to the ArrayList. | |
Re: [url]http://www.daniweb.com/forums/thread154611-3.html[/url] I spent 2-3 hours helping you, the least you can do is mark the thread as 'solved'. I also gave you a suggestion on how to do this in the other thread, although I don't think my suggestion was a good way to do it. But if you make … | |
I saw someone, I think it was s.o.s, recommend the use of BigDecimal to someone else. So out of curiosity, and having heard of BigDecimal before, I looked at the Javadoc to see how large the values it could hold were and how it held them. From the doc: "Immutable, … |
The End.