2,777 Posted Topics

Member Avatar for jssutton11

[QUOTE]solve the knapsack 0-1 problem[/QUOTE] Can you explain this problem? The code you posted isn't a complete program. If you expect help, can you post a program that compiles and executes and demonstrates the problem.

Member Avatar for jssutton11
0
379
Member Avatar for Konstar

It happens. They have a name for it: a bug Without the code to demo, who can say what happened.

Member Avatar for Stefano Mtangoo
0
66
Member Avatar for jwmollman

Is this the algorithm for producing the output: Print on each row then the number of $ equal to the row number. Ie 1 on first, 2 on second, etc That implies nested loops, one for the row and one for the row's contents.

Member Avatar for tong1
0
244
Member Avatar for Wootens

The case of the letter doesn't matter. What matters is that the spelling of the definition of a variable must match its usage: [CODE] Scanner scan = new Scanner (System.in); // Define a variable name = scan.nextLine(); // use the variable [/CODE] [QUOTE]How can I put everything on one line? …

Member Avatar for Wootens
0
246
Member Avatar for alleybye

Can you define an array of Strings: String[] anArray = new String[26]; // define array and fill it with the letters of the alphabet? String[] anArray = {"A", "B", .. to "z");

Member Avatar for bops
0
563
Member Avatar for FNHA

Do you have an infinite loop or a recursive call? How many times does your code loop in the while() loop? What causes/lets the loop end?

Member Avatar for FNHA
0
142
Member Avatar for Loveday

[QUOTE]I will compile and run the Applet code from the other class with a main method[/QUOTE] There is an interface: JavaCompiler for compiling a java program from within a java program. After the code is compiled and the .class file is available, you can create an instance of the class …

Member Avatar for NormR1
0
2K
Member Avatar for daudiam

That is really interesting. Here's the output from javap for two compiles. The first with the forward reference and the second without. Can't see any difference in what javap outputs. [CODE]class ForwardRefTest { // int a = this.h; // for first compile int h; int a = h; // for …

Member Avatar for daudiam
0
227
Member Avatar for Protoroll
Member Avatar for blknmld69

Do you understand what the error message is saying? 1) GradeProgram.saveBListener is not abstract 2) does not override abstract method actionPerformed You have coded "implements ActionListener" for those classes but have NOT added the required method for any of them. Add the required method to make the compiler happy.

Member Avatar for peter_budo
0
231
Member Avatar for daudiam
Member Avatar for justinwarner

[QUOTE]I want it to say false depending if paybackYears is greater than TEN[/QUOTE] Take that statement and extract the variables and the comparison operator and make an expression. Set a boolean to the value of the expression. For example: boolean aIsGreater = (A > B); // true if A is …

Member Avatar for ~s.o.s~
0
150
Member Avatar for ncstplaya1234

The First problem is that you have not posted a program that will compile. Can you fix that?

Member Avatar for ncstplaya1234
0
3K
Member Avatar for manishanibhwani

What kind of file is your "package"? How is it related to java programming?

Member Avatar for NormR1
-1
98
Member Avatar for jalpesh_007
Member Avatar for vinay1424

[CODE] int x = (int) (Math.random() * 5);[/CODE] Start on the inside and work out. What does the Math.random() method return? Read the API doc The value returned is multiplied by 5 (*5) That value is then cast to an int: (int) Now read what Ezzaral asked. Slight correction for …

Member Avatar for stultuske
0
116
Member Avatar for nilo

What is "selenium tool"? Can you provide a link? How does it relate to java programming?

Member Avatar for peter_budo
0
87
Member Avatar for pradn

If you can get a clean URL for the image on the site, you may be able to read the image from the site the same as a browser would be able to read it. Some sites require you to spoof them into thinking you are a browser.

Member Avatar for peter_budo
0
63
Member Avatar for shapam

[QUOTE] how to java path[/QUOTE] Can you explain what you are trying to do? java is not a verb so your question does not make sense. Did you leave some words out?

Member Avatar for peter_budo
0
106
Member Avatar for acash229

Cross posted at [URL="http://www.java-forums.org/new-java/32441-need-help-timer-java-2.html#post143383"]http://www.java-forums.org/new-java/32441-need-help-timer-java-2.html#post143383[/URL]

Member Avatar for brandonrunyon
0
292
Member Avatar for raym.mart

What are your questions about the assignment that you posted? What code have you written for it?

Member Avatar for raym.mart
0
208
Member Avatar for redZERO

The normal way for a java program to access and write files has nothing to do with whether the code is in a jar. If you can write a program to read and write to a file using files vs resources, that class will work the same if it is …

Member Avatar for NormR1
0
2K
Member Avatar for blknmld69

The definition for a class must be on the classpath for the javac or java program to find and use it.

Member Avatar for NormR1
0
202
Member Avatar for hajjo

The background for what you see is that when the compiler seeing an object item in the println() method call, it calls the object's toString method. The default toString method for the Object class returns: typename@hashcode where hashcode default value is the memory location of the object

Member Avatar for jon.kiparsky
0
86
Member Avatar for boiishuvo

Where is the image file? Is it with the class file? [QUOTE]they didn't appear on the screen eithe[/QUOTE] What screen? Please explain where you expect to see them.

Member Avatar for Ezzaral
0
298
Member Avatar for gunjannigam

[QUOTE]i want a forward slash "/" in the path[/QUOTE] Run it on linux. It uses the / for separator

Member Avatar for JamesCherrill
0
185
Member Avatar for Shadow101

[QUOTE]what's the "BankAccount" in 'public void embezzle(BankAccount other)' [/QUOTE] 'BankAccount' is the type of the arg passed to the method. To call the method, you must use a variable that refers to a BankAccount object. [QUOTE]Second, How can i add funds from the other account to the other account?[/QUOTE] To …

Member Avatar for Shadow101
0
115
Member Avatar for 47pirates

When you have a variable in one class that you want to get the value of in another class, you can add a getter method to the class with the variable and have the other class call that method. A getter method is a method that returns a value. For …

Member Avatar for 47pirates
0
320
Member Avatar for dem10

Is the ^ underneath the same letter in your posted message as when output by the compiler? [CODE]public BankAccount(String, double, double)[/CODE] I suspect that the compiler was pointing to the list of args to the constructor. All the args need variable names.

Member Avatar for stephen84s
0
128
Member Avatar for cac186
Member Avatar for NormR1
0
140
Member Avatar for NewOrder

A suggestion. Change this: [CODE] System.out.println(array[4-b]); System.out.println(b);[/CODE] to this to put a label on the output vs just having a raw number standing there by itself [CODE] System.out.println("array[4-b]=" + array[4-b]); System.out.println("b=" + b);[/CODE] Where do you show the value of SpacesX?

Member Avatar for JamesCherrill
0
163
Member Avatar for bangor_boy

[QUOTE]bizarre two-character EOL[/QUOTE] Line printers printed backwards and forwards. There needed to be a control character to move to the next line directly below the current print head position and not to the head of the line.

Member Avatar for jon.kiparsky
0
85
Member Avatar for tonyfingures

See the answer posted at [URL="http://www.java-forums.org/new-java/32528-birthday-party-code.html#post143795"]http://www.java-forums.org/new-java/32528-birthday-party-code.html#post143795[/URL]

Member Avatar for NormR1
0
1K
Member Avatar for NewOrder

What is the question? To debug your code print out the value of this expression, of each of its sub expressions and of all of its variables: (pieces[rowStart-b][columnStart]==null && pieces[rowStart-b][columnStart]!=pieces[rowEnd][columnEnd] && pieces[rowEnd][columnEnd]==null)

Member Avatar for NewOrder
0
118
Member Avatar for nezbo

Try reading an extra line before exiting the program to keep the console window open until the user enters something. Also its useful in a program that is waiting for input from a user to print a message telling the user what is going to happen. In your program you …

Member Avatar for NormR1
0
193
Member Avatar for flyingcurry

To catch all exceptions add a further catch(Exception x) following the last catch you currently have. Please execute the program, copy all of the screen for your test and paste it here. Where does your code test if the user input a 'q'?

Member Avatar for NormR1
0
208
Member Avatar for loveu

What code do you have so far? Look at the methods in the String class for checking if a String contains another String. For testing the search algorithm, I'd hardcode in your program a value to search for and leave off getting the value from the user until later. Once …

Member Avatar for NormR1
0
47
Member Avatar for blknmld69

Does it work? Are you getting all the records from the file into the vAccounts Vector?

Member Avatar for stultuske
0
215
Member Avatar for sushil490023

Do you see any pattern for where the 0s and 1s are located in each line? The 1s move in until there is only a single 1 and then they move out. [QUOTE] it is urgent[/QUOTE] Oh. For urgent jobs, that will cost more.

Member Avatar for sushil490023
0
83
Member Avatar for Katana24
Member Avatar for bangor_boy

Yes, those methods could work provided the contents of points follows the rules. Read the API doc for the methods for what the rules are.

Member Avatar for Ezzaral
0
157
Member Avatar for LianaN

[QUOTE]MouseListener to JMenu[/QUOTE] What kind of MouseEvents are you interested in?

Member Avatar for NormR1
0
180
Member Avatar for javadumbass

Also while your are developing the code as James mentioned, add some print statements in the listeners to show the x,y values where the mouse was clicked and moved to. There are different points of reference: to the screen and to the component for example.

Member Avatar for javadumbass
0
1K
Member Avatar for NewOrder

Try debugging your code to see why the variable in question is set to the values it is by adding print outs to show where it is set and with what values. For example for this: valid1 = !(a<size); add just before that statement printout of ("a=" + a + …

Member Avatar for NewOrder
0
107
Member Avatar for smoothe19

[QUOTE]How do I fix this[/QUOTE] Can you describe/document what that statement is supposed to do? To see what values it is testing, print out the value of the expression before the if statement.

Member Avatar for Akill10
0
592
Member Avatar for esy928

How about the wait() method? The API doc says: Causes the current thread to wait until ...

Member Avatar for NormR1
0
2K
Member Avatar for sivaprakashm

Do you need help writing an abstract class? Are you getting compiler errors? What textbook are you using for learning java?

Member Avatar for jon.kiparsky
0
77
Member Avatar for beginner21

[QUOTE]my problem..how to show the resulted images when the search button is click[/QUOTE] You need a couple of things added to your code. Definition for the yeahFrame class. Code to create the image. Code to show the image.

Member Avatar for masijade
0
132
Member Avatar for extemer

@tong1 If you are going to feed code to OPs, can you at least add comments to your code explaining the tricks you are doing?

Member Avatar for extemer
0
12K
Member Avatar for NewOrder

Is anyone looking at the OPs code? [CODE]if(deltaX<0 && deltaX<0){[/CODE] This is really careful code. Don't trust just checking it once, do it twice to be sure.

Member Avatar for NewOrder
0
101

The End.