1,678 Posted Topics
Re: booster1 and booster2 are Objects, you can't print them out as if they are Strings. Use booster1.name and booster2.name or whatever your instance variables are that are Strings that will print nicely. OR override the Object class's toString() method, provide your own implementation, then call booster.toString() in the println. | |
Re: Java and Javascript are not the same thing. | |
Re: [QUOTE]Assign various Ship, CruiseShip, and CargoShip objects to the array elements.[/QUOTE] Your program isn't correct; the teacher is trying to demonstrate a concept called Polymorphism to you. Essentially you should be creating Ships like this: [CODE]# Ship[] types = new Ship[6]; types[0] = new CargoShip(); types[1] = new CruiseShip(); types[2] … | |
| |
Re: Read the rules pertaining to "we only give homework help to those who show effort", then come back and post something that shows effort. And no, it does not matter whether this is homework or not. Everything posted here falls under that rule. | |
Re: Both pieces of code say they work above the code. Which one doesn't work? The second one? And can you please fix your bracketing, I can't tell which brackets go with what. The brackets should be aligned so that the closing bracket is in the same column as the opening … | |
Re: This is going to sound stupid but did you try to open it as plain text... like in wordpad? (Or you can do so in other editors). And what is the file extension? Like .txt for example or .java | |
Re: For specific components see here: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/index.html[/url] (for example, if you want to use a button in your app, look there to see how, or if you want to use a table, etc) | |
Re: Your program isn't going to work. In your method celciusToFarenheit, you tried to compare with "if degree == c". However, if you look at [URL="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JOptionPane.html"]this link[/URL] you will see that the JOptionPane class's showInputDialog method (the one you called, where you said degree = JOptionPane.showInputDialog...) returns a [I]String[/I] which is … | |
Re: Your error indicates that you attempted to parse an integer at line 128 of your program (which is correct: it says Integer.parseInt(input)). However, the program was unable to parse an int, because your input did not immediately contain an integer. Which means you are reading in the file incorrectly. For … | |
Re: You should only extend a class if you need to add functionality to the class (or modify the class's functionality so that it does something different). I doubt that you need to do either of those things for JFrame, so unless you have a compelling argument, don't extend JFrame. Also, … | |
Re: [QUOTE=weylinthedirty;1061955]I was thinking about simply adding an input box onto the JPanel Menu. That way you could type a number, select a radio button then hit submit and that same window would stay open. I couldn't figure out how to do that though. I kept getting incompatible type errors.[/QUOTE] Post … | |
Re: [QUOTE=Perveance;1061553]Where is class Phrases code? It will be easier for me to find your mistakes having all your project's code.[/QUOTE] Did you even look at his code? The problem is obviously with the way he is reading in the text file. @OP: Scanner's next() method reads in input between the … | |
Re: Are you trying to manually do a character by character search to match words? That is a mistake. Technically it could work but the amount of effort would be enormous and fruitless. I see that your "words" can actually be multiple words with spaces between them. My first thought is … | |
Re: abstraction: a concept or idea not associated with any specific instance So in computer science, I think that abstraction deals with what something does, not with how it does it. So saying that all Cars can drive, without considering more specific details of the Car, is an abstraction. I don't … | |
Re: And also make sure to read about Classes in Java and Objects in Java. int, double, float, boolean, long, short, etc can not use method invocations ( like someInt.someMethod() ) because they are not class types!!! | |
Re: Overall I'll just say thanks to the mods because they manage to keep a forum this large in order, while still [supposedly] managing to like the site as a member, and I know how difficult that is. My favorites are basically the mods in the Java forum, surprise surprise. And … | |
Re: SWT was created for faster native widgets - it is faster because it uses the OS's native tools to draw the widgets, essentially. However, Swing should be plenty fast for most any purposes, and I personally prefer it. I also think Swing looks nicer. P.S. I used SWT at my … | |
Re: Get help from a professional, in person, with your write up. Here are some tips since I've been through similar processes myself, but I'm not a professional at this, nor are most anyone on daniweb. And if you don't get help from a professional, at least get help from someone … | |
Re: So. . are you [I]simulating[/I] this process by creating threads on your local machine? Or are you actually using multiple machines and communicating with some master-server that acts to combine the results and to spawn the processes on the other machines? My reply assumes you're simulating it, and only using … | |
Re: [QUOTE=eggmatters;1035630] Time it takes my Linux box to load on startup: ~45 seconds to one minute (and it has issues) [/QUOTE] Are we comparing things that depend on your hardware's speed now? In that case my dell running on Vista loads in less than that. I'll be back online shortly, … | |
Re: It sounds more logical the way you have it - for example, to have the game class keep a list of what Objects are currently showing on screen, then when the player wants to attack, you can call getClosestObject() or something of that nature to decide how the a button … | |
Re: No, I don't think there are non-trivial ways to do it with a standard grading system, other than the obvious ways which have been listed in this thread already. I don't understand the system you listed, but consider that since 90 and 100 are both usually considered A's, you can't … | |
Re: Not to be repeating myself. . but call of duty came out recently. . | |
Re: I hope your existence on this site is a joke. And obviously the U.S. government is hiding secrets, as is every other government in the world, just nothing like the crazy crap you are talking about. | |
Re: I actually PMed Dani with this same question a few weeks ago, but I received no response. I didn't want to post it on the forums though. If you guys want to get a one time donation system set up, let me know when I don't have to go out … | |
Re: [url]www.eclipse.org[/url] [url]www.netbeans.org[/url] (or is it com?) google | |
Re: Your LoadStudents method doesn't make sense to me. You said while(s.hasNextLine()) but you never read anything in, so I'd think that would be an infinite loop. Additionally, you kept adding a new Student with the argument 'tempPerson', but tempPerson doesn't seem to be changed anywhere. You'll need to post more … | |
Re: The StringTokenizer class documentation says its use is discouraged in new code and to use String class's split method instead. And you cannot cause a String to be evaluated as if it was a piece of programmer written code. Instead, you could use if statements, for example "if a + … | |
Re: If you have a file full of ints then you would just use [CODE]while(scanner.hasNextInt())[/CODE] You would not use scanner.hasNext() and then the if statement, that is an extra unnecessary step. You could try something like [CODE] System.out.println("Enter an int"); while(scanner.hasNextInt()){ int i = scanner.nextInt(); System.out.println("Enter an int"); }[/CODE] | |
Re: There is no reason you'd ever pass "this" as an argument. "this" just refers to the Object of the classtype that you are currently in. So if your class name is Car, and you say "this." anywhere within a method (other than main) in the Car class, then "this." refers … | |
Actually, at the risk of sounding whiny, I retract my statement. But I still believe that new members misuse the down vote system to "spite vote" | |
Re: abccba if you add each letter in order to the stack and the queue, here is the final stack and queue (in the order they would be popped off) 1. abccba 2. abccba But looking at something random that isn't a palindrome: abc 1. cba (stack) 2. abc (queue) So … | |
Re: If you have purchased a version of Windows, if you then use a different, even stolen version of Windows but can prove that you purchased it previously. . it is still illegal, but highly unlikely that you would ever be prosecuted for it. The same as if you bought a … | |
Re: I haven't worked with Applets, but I think they work the same way as Swing basically? (Edit: confirmed - one whole point of JApplet is that it works with Swing). Use a JPanel or whatever the standard applet window is called, make the layout a GridLayout(x, y) where x and … | |
Re: That drunk guy video is unbelievable. I've been around my fair share of drunks, but nothing remotely close to that. It looks like a supernatural power is controlling him with a will to get beer. | |
Re: I read occasionally. Authors I like include: David Baldacci, John Grisham, Brian Jacques, J.K. Rowling. | |
Re: I don't know how people get that ugly. Nevermind the bad dressing. | |
Re: Post your relevant code and tell us what part you're having trouble with. If your problem is not knowing enough about Timer and Threads, then read google. We'll be happy to help you with specific problems, however. | |
Re: Check is extremely simple actually. If any piece can currently move to the king's position, then the king is in check. Since you already have to implement the ability to allow players to move any given piece to any square (that their piece can move to), deciding if those pieces … | |
Is it true that code tags now "know" what forum they're in? Because I was only posting one line of code so I didn't use the =Java tag in the Java forum, yet it got posted with the Java code tags instead of the regular code tags. If that is … | |
Re: My question for him is why he couldn't at least thinly veil the obvious COTS "my professor wrote this and then I pasted it on daniweb"... question | |
Re: What is a consolidated account? Just an account under both names? What do you have to do to 'make an account consolidated'? | |
Re: What is subpanel? Up till line 9 your code seems ok to me, after that I have no idea what you are trying to do. | |
Re: The last part is definitely wrong. digit % 10, if digit = 245, will be 5. But digit never gets modified there, so your program will run forever. What you should be doing is using a combination of % and / . | |
Re: A text based table? Or a GUI table? For the first use System.out.println() in a for loop to print your items to the screen, for the second, you can use a JTable and there are tutorials for that on google. In either case, if you are new to Java, you … |
The End.