ELL TIM

Greenhorn
+ Follow
since Mar 24, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ELL TIM

just figured it out actually. Thanks for the tips! (^_^)
14 years ago

fred rosenberger wrote:

for (num1 * num2 == result) //(have problem)


I'm not sure what you are trying to do here. What you have in your parens: "num1 * num2 == result" is essentially a boolean. it's either 'true' or 'false'.

A 'for' statement doesn't take a boolean - it takes three things for setting up, testing, and updating variables. Then, the code inside the curly brackets potentially runs multiple times.

So really, the question is, what are you trying to DO there? Are you trying to test something? i don't think so, because it's a repeat of what's in your if statement just above it.

I assume you are trying to loop around and print out all those products.

So, as others have said, look in a book or online tutorial for how to set up a for-loop. Then, see if you can write one that does nothing more that prints "hello" 12 times. Then get it to print something like:

1
2
3
4
5
6
7
8
9
10
11
12

etc, and add a little bit each time.




Sorry bout the code,i'm new to this site..also new to java programming...the thing is i want the output to print out like this when user key in the second number,then the multiplication are base on the second number.

1 x 2 = 2
2 x 2 = 4
3 x 2 = 6
4 x 2 = 8
...
...
...
12 x 2 = 24

i try using this code but still cant get what i want..

15 years ago
i've this class assignment that says:

Design and write an ArithmeticGUI class that allows users to input play with numbers multiplication. The GUI should contain three JTextField, one for input first number, second for second number and third for the result of multiplication of both numbers. There should be one button which the user can signal that correct multiplication result has been entered. The multiplication table of the second number should be displayed in the text area and the correctness of the multiplication result should also be displayed in a text field, but this should be set uneditable. A sample Arithmetic GUI interface is displayed below:

If users input a correct multiplication result of two numbers, the below should happened:



If users input a wrong multiplication result of two numbers, the below should happened:




i've already try it but i have problem at the for loop structure...
here the java code that i try..





please help me solve this...
15 years ago