202 Posted Topics

Member Avatar for aappee

It looks like the author of the code you found is doing something slightly different from [URL="http://5dspace-time.org/Calendar/Algorithm.html"]this algorithm[/URL], but only slightly. This might help you understand what the code is doing.

Member Avatar for aappee
0
140
Member Avatar for gedas

1. you misspelled array.length in your for loop 2. in your print statement, use the variable i instead of the constant 0 [CODE] System.out.println(array[i]); [/CODE] Also, in your displayName method: 1. Move the declaration of [icode]int i = 0;[/icode] outside of the while loop (before line 13) 2. Move [icode]i++;[/icode] …

Member Avatar for gedas
0
133
Member Avatar for alastair1008

You need to implement MouseListener to see if the mouse button has been pressed, and you need to implement MouseMotionListener to keep track of where the mouse cursor is on the screen.

Member Avatar for kramerd
0
127
Member Avatar for jems5

1. Create a boolean variable found and initialize it to false just before your loop on line 90. 2. Replace your print statement on line 92 with these 2 statements: [code] found = true; break; [/code] 3. Get rid of lines 94-96. 4. After the for loop ends, put your …

Member Avatar for jems5
0
2K
Member Avatar for Tankadin

Without trying to write Java code, can you write an outline (in English) of what your program needs to do? You can number steps like this: 1. Open the input file for reading 2. Read a line from the file ... What needs to be done for each line in …

Member Avatar for kramerd
0
180
Member Avatar for richies
Member Avatar for Sunshineserene

In your MatchApplet class, create a public method called get2DArray, or getMyDouble, or getResidueScores - something that makes sense in your program. The method should be of type double[][], and should return the variable called mydouble. If mydouble is a static array, then the method can be static too. If …

Member Avatar for JamesCherrill
0
160
Member Avatar for soccer13

Scanner can not only read lines from a file, but it can also be used to parse a string. You could create another Scanner called parser outside of your loop and use it inside your loop to get the data from the input line like this: [CODE] parser = new …

Member Avatar for soccer13
0
120
Member Avatar for jliao20

Since LetStatement takes a single character variable name and since the variables array in ProgramState is 26 integers, I would assume that each variable is a letter of the alphabet and you need to map letters to integers 0-25. That way there's no need to store the variable names in …

Member Avatar for Taywin
0
258
Member Avatar for Blastoise
Member Avatar for Eric Cute
0
147
Member Avatar for Juicebox

Start by taking the description you posted and breaking it down into a number of steps you need to accomplish to solve the problem. For example: 1. Get player to set min & max values 2. Generate random number between min & max 3. Get player to make a guess …

Member Avatar for kramerd
0
174
Member Avatar for fender422

It's hard to know exactly what's going on since you didn't include your WorldOfWarcrap class, but in method fightToTheDeath on line 122, you call [icode]opponent.attack(RPGCharacter);[/icode]. Do you ever initialize the static variable RPGCharacter? Perhaps you should pass the keyword [icode]this[/icode] instead? By the way, it's generally not a great idea …

Member Avatar for kramerd
0
188
Member Avatar for ceyesuma

Typically a menu item's action is handled in some Action class (extends AbstractAction). So you might have one class called something like BuildTabbedPaneAction that extends AbstractAction and another called BuildInternalFrameAction that also extends AbstractAction. Each of these classes implements the actionPerformed method to "do its thing". When the Actions are …

Member Avatar for ceyesuma
0
143
Member Avatar for manaila

It is a bit confusing at first, but when you reference source files (.java) in packages, you use slashes, and think of the packages like directories or folders (which they are). When you are dealing with class files, you use dots instead of slashes.

Member Avatar for Shanki87
0
139
Member Avatar for hatux

A Scanner can be used to get keyboard input from the user. I think you want to analyze, tokenize, etc. the user input, not the Scanner object itself. Try this: [CODE] Scanner in = new Scanner(System.in); // better name than asdf System.out.println("Enter some text."); // good idea to prompt for …

Member Avatar for kramerd
0
153
Member Avatar for arawani

Methods settotalPrice() and settotalPriceWithTax() are both type double, but neither one has a return statement.

Member Avatar for arawani
0
98
Member Avatar for appunu

I don't think hashtable is the correct structure for the data you are trying to store if you are just using a string for the key and a string for the value. In a hashtable, the keys are supposed to be unique for each unique record, but in your post …

Member Avatar for kramerd
0
140
Member Avatar for Amrinder07

Not sure what you want to do in the loop, but maybe the Start button should start a new thread, and the Stop button can stop it? See [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Thread.html"]this link[/URL].

Member Avatar for Amrinder07
0
148
Member Avatar for Khodz

Are you trying to append to the end of the existing file? If so, see this link: [URL="http://www.artima.com/forums/flat.jsp?forum=1&thread=118486"]http://www.artima.com/forums/flat.jsp?forum=1&thread=118486[/URL] Not sure it that's what you're looking for...

Member Avatar for Khodz
0
193
Member Avatar for someone5

No, you don't have to do both things in just one class. Which class has a main method? Inside main you will construct instances of both classes, and then you can put them together (add the form to the window). If you don't understand this, post your code (using code …

Member Avatar for someone5
0
1K
Member Avatar for LianaN

Do you know what line of code is causing the exception? Try doing e.printStackTrace(), rather than System.out.println(e.getMessage()).

Member Avatar for LianaN
0
579
Member Avatar for javanew

??? I don't know why ceyesuma is talking about XML here. ??? javanew, when you say your code "doesn't work", what do you mean? Are you getting an error when you compile? When you run? Is it not doing what you expect? If that's the case, please describe the program's …

Member Avatar for javanew
0
147
Member Avatar for gigimariah

Are you getting a syntax error? What is the error? We can't help you understand the errors if we don't know what they are. Please post you code in code tags next time.

Member Avatar for javanew
0
93
Member Avatar for usccapo

You need to make some effort yourself first before anyone here will help you. This forum is not a place to find someone to write code for you.

Member Avatar for peter_budo
-1
135
Member Avatar for caro11

[QUOTE]location: class javaapplication18.compteBancaire[/QUOTE] For some reason the class in the error message starts with a lower case 'c'. Check your file name - it must match the name of the class, and case matters.

Member Avatar for caro11
0
127
Member Avatar for khaled_jawaher

According to your date formatter, you are expecting month to come first. 13 is not a valid month.

Member Avatar for kramerd
0
2K
Member Avatar for sajidshamshad
Member Avatar for vikas.kethineed

Here is your code fully parenthesized and inside code tags. [CODE] public boolean isLeapYear() { if (years % 4 == 0) { if (years % 100 == 0) { if ( years % 400 == 0) { return true; } else { return false; } } // what should be …

Member Avatar for kramerd
0
228
Member Avatar for Nidhi S.

The error says your problem is at line 149 in ImagesTest.java: at ImagesTest.RefHist(ImagesTest.java:149) But I just ran your code and did not get the error. Did you try running it again? Do you always get this same error?

Member Avatar for Nidhi S.
0
1K
Member Avatar for sirlink99

The problem is the for loop. Before it executes, loaded=0 so there's nothing to draw, and after it will be something like 1000000001. Only then will the bar be drawn again.

Member Avatar for sirlink99
0
166
Member Avatar for ASIWYFA

1. You are calling calcSum 3 times (lines 21, 22, 28). You should only call it once (line 28). 2. On line 22 you should just refer to the static sum variable rather than calling calcSum again. 3. Since you have sum as a static variable, you don't need to …

Member Avatar for ASIWYFA
0
427
Member Avatar for hatux

1. Your code isn't in a method. Try putting it in a main method. 2. You have the array fileslist declared twice: on lines 6 and 12. Change the declaration on line 6 to [CODE] String fileslist[] = null; [/CODE] and change line 12 to this: [CODE] fileslist = directoryOfTxts.list(); …

Member Avatar for hatux
0
150
Member Avatar for jemimaloh

Yes, you should be able to read a directory without putting your program in that directory. If you are able to list the files, you should also be able to access those files, but you need the path to the files in order to process them. It looks like the …

Member Avatar for jemimaloh
0
119
Member Avatar for TahoeSands

See [URL="http://download.oracle.com/javase/1.4.2/docs/guide/awt/demos/lightweight/RoundButtons/actual/RoundButton.java"]this link[/URL]. It doesn't do the mouse over bit, but it does handle the click, so it should get you started. Also, the code just draws a circle for the button, but you can change the paint method to draw an image, something like this: [CODE] class JImageButton extends …

Member Avatar for kramerd
0
93
Member Avatar for lilsmurf

I don't see any output. How is it telling you the total? The loop that is supposed to go for some number of years will only every go one time because year is set to 0 and lcv is also set to 0.

Member Avatar for stultuske
0
84
Member Avatar for bonett09

If your class doesn't have any constructors, then Java will supply a default one with no parameters. But as soon as you supply a constructor, Java no longer supplies any. So if you want to be able to construct a Car with no parameters, you have to supply a constructor …

Member Avatar for kramerd
0
149
Member Avatar for incubus9x9

I'm not sure I get what you're asking but if you want a menu to print out, something like this: 1. Forward 2. Backward 3. Forward Global ... etc. Then you need to put your print statements before the switch statement. You say this worked with an if/else statement, but …

Member Avatar for incubus9x9
0
143
Member Avatar for FallenPaladin

Look up the documentation for the Math class, which has the trig functions you are looking for, in addition to square root and exponent functions. If this is not enough help, ask a more specific question.

Member Avatar for FallenPaladin
0
192
Member Avatar for sirlink99

Use a good code editor to help you find where your bracket error is. And please use the code tags next time you post code.

Member Avatar for kramerd
0
111
Member Avatar for lilsmurf

What is the value of numMonths? If it is 0, the for loop won't execute.

Member Avatar for cale.macdonald
0
90
Member Avatar for AaronLLF

Sorry, AaronLLF, it looks like no one here knows how to help you. Try searching google or post your question on a different forum.

Member Avatar for FallenPaladin
0
332
Member Avatar for joshianurag18

[URL="http://www.example-code.com/java/javaftp.asp"]http://www.example-code.com/java/javaftp.asp[/URL] (Google search terms: java move file ftp)

Member Avatar for kramerd
0
136
Member Avatar for XxPKMNxX

You could write a boolean method that loops through your array, since for every card you're checking the same condition. Then your if statement becomes just a call to that method.

Member Avatar for XxPKMNxX
0
98
Member Avatar for Christ90

You need to make an effort on your own before people here will help you. Have you written any code? If not, give it a try yourself. When you have some code and you are stuck, then post the code along with a more specific question.

Member Avatar for kramerd
0
133
Member Avatar for sixdegreesunder

In java, curly braces { and } define what is known as scope. When you declare a variable, the nearest curly braces define the variable's scope, and the variable is not visible outside that scope. You have code that looks like this: [CODE] if (machine == 1) { char m_weapon …

Member Avatar for kramerd
0
217
Member Avatar for serph09

Each place where you see in.nextDouble();, that is where your program is trying to read input from the user. In general it is bad form to have an input statement without an output statement to prompt the user first. So just before lines 4 and 8 I would insert a …

Member Avatar for masijade
0
542
Member Avatar for jems5

The comment above your loop says you are inserting a character into the array, but inside the loop all you are doing is printing out the array. Where does the character get inserted? Your code to print out the array looks fine by the way.

Member Avatar for jems5
0
1K
Member Avatar for sateal8

Are you saying the blank spaces are required? Would the date 01/23/10 be invalid? A space character can be represented as ' ', or as a string, it would be " ". The slash character is just '/', or as a string it would be "/". Does that help? I …

Member Avatar for kramerd
0
86
Member Avatar for Cheese Man 808

When you use System.out, you are using println, which prints the string and then a new line. But when you use out to print to the file, you are only using out.print (line 131). Change this to out.println to get each line of text on a new line.

Member Avatar for Cheese Man 808
0
1K
Member Avatar for Sonia11

1. remove the last character from the input string 2. create a new string consisting of that last character 3. to the new string, append a recursive call of your function with the rest of the input string minus the last character Note that you will need to figure out …

Member Avatar for cale.macdonald
0
108

The End.