My program is not working
i have built a program and it runs. The only problem is that i tell it to do an equation with a random number and it always gives me the number 0. Please help! Here is the program.
public class luck
private static int input;
public static void main (String args)
int num1 = 4;
int num2 = (int) (Math.round(Math.random()*25));
int num3 = input;
String input = JOptionPane.showInputDialog("Enter your happieness on a scale from 1-10");
answer = num3*num1*num2;
The forum is for learning...
@Mohamed: I know you mean well, but giving complete code to the OP is not a good idea. You're actually not helping at all. The purpose of the forum is to help learn Java and giving complete solutions doesn't do that (too much tempation to "cut & paste & I'm done"). If you noticed, I didn't give the OP any code... I gave him links to study (due to the level of knowledge that is shown) and then if he had questions, the forum could help him further.
replying on your objection
i know that the purpose is to make him learn but he made a code and he didnt know what is the mistake
Originally Posted by CJSLMAN
so i helped him to solve it
i cut and paste the code because it is very important for the developer to read someones code and understand it
so i give him this benefit
i hope i replied u