7,116 Posted Topics
Re: No. Nobody here will write those mthods for you. This isn't a "we do your homework" service. If you would like to learn how to write them yourself then lots of people here will help you learn. Post what you have done so far. | |
Re: if(stringproduct == new problem004().reversed) == for two objects tests if they are exactly the same object (same address in memory etc). In this case these are always two separate objects. The String class has an `equals(String another)` method that tests if two Strings contain the same sequence of characters... | |
Re: This is one of the worst questions in a long time! Is this a message that you got when trying to execute a 20 year-old Mac program on a Linux system with a dead hard disk? No? OK, then is this a message you got when you pointed your web … | |
Re: Without knowing how your program and its data are structured, it's almost impossible to answer that question. What's the "switch" you refer to? Anyway, converting an int 1-9 into row/col values is just simple arithmetic. You need the divide operator / and the remainder operator % ps if (board[rows][cols] != … | |
Re: Every time you append a word you reverse the entire string, so the last word is reversed once, the previous word is reversed twice, the word before that is reversed 3 times, ... , and the first word is reversed (words.length) times. Of couse an even number of reversals is … | |
Re: The Oracle tutorials are very good... start [here](http://docs.oracle.com/javase/tutorial/essential/concurrency/procthread.html) | |
Re: Just setting x and y to to mouse's coordinates should be enough - the next timer event will call repaint which will paint the ball at that position. | |
Re: Read the [API doc](https://www.daniweb.com/software-development/java/threads/485162/jdbc-basicson-statement-interface-#post2123987) for The Connection class, setAutoCommit method. | |
Re: This thread doesn't add up. "price" is an instance variable. The language defines that it will have a default initial value of 0.0 All instance variables are initialised to their defined default values (0, 0.0, false or null as appropriate) when the instance is first created. (NB as a primitive, … | |
Re: Did you look at the links stultuske posted? What specifically about SimpleDateFormat are you having trouble with? | |
Re: That code contains fatal errors that prevent it from compiling, so there's no possibility of running it. Eclipse will have flagged the errors, so fix those first. | |
Re: Buffered reader just has a FIFO stack of characters supplied from the underlying input stream. Each time you call read() it pops the first char and returns it to you. | |
Re: You can close() a Scanner, but if you are using System.in then the close() has no effect (System.in cannot be closed), so people don't bother. flush() writes any buffered output to the underlying device and allows you to continue writing to it. close() writes any buffered output to the udnerlying … | |
Re: There's nothing to gain by messing about with a 1D array. You can start with an array of doublets (arrays with 2 members), and add solutions to that as you find them. If you overflow the size you will need to copy to as larger array, and at the end … | |
Re: javac.exe needs a file name, but java.exe takes a class name as its parameter, so you don't add the ".class". Ie the correct command is just java apples (confusing? yes, but that's how it is) | |
Re: You need to explain what help you need. DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you … | |
Re: One small point: instead of using the mysterious 97, you can use the char literal 'a' which makes the code far more obvious, eg index = char - 'a' newIndex = (index + 5) % 26 newChar = 'a' + newIndex | |
Re: WIth Java 8 Oracle have implemented new date and time classes that incorporate the best ideas from previous attemepts, and draw very heavily from Joda. There's probably no reason to use Joda any more, just use the new classes that are now part of the standard Java install. | |
Re: The code does angle calcs using 360 in one place and 2pi in another, so maybe you are mixing or confusing degrees and radians? | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: You have the right download page. For XP 32 bit use the "Windows x86" version. Don't forget to click the "accept licence agreement" button before downloading. | |
Re: You have not restricted the type of your generic argument, so number1 and numnber2 could be any kind of object - Strings, URLs, Files, JRadioButtons... consider GenericsArithmetic<File> integerNumbers = new GenericsArithmetic<>(); No way you can expect Java to add them. You need to restrict the type, eg start with something … | |
Re: Show the code that's writing that info. | |
Re: That example has all the code and extensive explanations. What exactly do you need that's not in the code or the explanations? | |
Re: They are all three the same. Their names come from different ways of looking at and thinking about lists, but in the end they all do the same thing (remove and return the first item in the list). | |
Re: You can create Java File that refers to a directory just like you can for a file, ie new File(directory path). Once you've got the File object for the directory, you can use its listFiles method to get all the files (optionally matching a filter for .txt files only) in … | |
Re: There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) … | |
Re: You calculate the result, but you don't display it. You need to `setText` for the output display field, using the result text you have calculated | |
Re: This sounds like you should be writing a browser addon, in which case Java is not appropriate. | |
Re: "Getting errors" tells us nothing. If you have a compiler or runtime error message post the complete message plus the actual code it refers to. If your code is giving an incorrect result explain what result you get and what the correct result should be. If you want people to … | |
Re: int amount = scan.nextInt(); String[] name = new String[amount]; String[] secondname = new String[amount]; Yes, that's perfectly valid sensible code. | |
Re: It seems there's an error in the syntax of the `java` command that you are trying to use to run your program. Exactly what are you typing? | |
Re: If you want to display the output (the contents of the array at the end), and you know loops and print, then what exactly is your question? | |
Re: What you have done with the variables prices (regPrice, overnightPrice) isperfectly valid, but could be a little better. The problem is that to find out what value is used you need to look in two widely-separated places, so it's not easy for someone else to folow that code. It's much … | |
Re: How about three actual pictures for the R/P/S ? And an animation that shows the result (eg scissors cutting paper) complete with appropriate sounds? | |
Re: How about a Game class that, among other things, has a` public` `joinGame(Player p)` method that stores each player in a private 4 element array. That class is then a place where you keep track of the Players and the state of the game. Rather than join players together directly … | |
Re: I don't know why you have started a new thread to continue this topic, but anyway, see my replies in part 1. | |
Re: titus.k.s Stop posting the same question twice. Next time you will get an infraction, possibly leading to a complete ban. Read the DaniWeb rules carefully before you post again https://www.daniweb.com/community/rules And yes, as people have already pointed out, there's no point trying to work with GUIs and databases when you … | |
Re: If you Google "writing a compiler" you will find lots and lots of tutorial material that will tell you what you need. It shouldn't be difficult to extend it to run on a server from a web browser. | |
Re: There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) … | |
Re: Yes, they are all the old versions. Just download the latest (Luna) and ignore all the others. | |
Re: Are you trying to do this? actionPerformed ... show "busy" message do some stuff remove "busy" message if so... Everything to do with Swing (eg painting the screen, running actionPerformed methods) happens on a single thread - the "Event Dispatch Thread", or "EDT", or "Swing thread". That means that once … | |
Re: Assuming you asre using a JTabbedPane (if not, you should be), you can learn how to respond to a button click here http://docs.oracle.com/javase/tutorial/uiswing/components/button.html and how to work with tabbed panes here http://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html Look for how to add an action listener to the button, and how to switch to a specific … | |
Re: Think about this example. The `Comparable` interface defines a method `compareTo` that compares two objects so they can be sorted etc. Many classes implement this interface - eg Integer, String etc, and each implementation is different because the way you sort Integers is different from how you sort Strings (etc). … | |
Re: You create a subclass of JPanel and override its paintComponent method to draw your image when the panel is repainted. Then add your components to the panel to display then in front of the image. Sounds complicated, but the code is quite simple. [ Here's](http://impressive-artworx.de/2011/background-image-on-jpanel/) a decent example | |
Re: Was that 64 bit NetBeans? What's wrong with Java 8 (the current version)? | |
Re: Small point: Java programming conventions prefer the use of "camel case" rather than underscores, so accountBal would be better advice than account_bal. | |
Re: If you think about it... You need to know what all the abbreviations are before you can start processing the text file. So the overall plan needs to be: read all the abbreviations into an array or other data structure for each line in the text file search the line … | |
Re: Before asking someone else to check your code try to compile and run it. If it runs and gives the correct answers then it's probably OK. | |
Re: There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) … |
The End.