import javax.swing.JOptionPane;

public class PossitiveNegative{
public static void main(String[]args){

int N1, N2, product, PoNoN1, PoNoN2;
String N1Str, N2Str, productStr, OutputPoNoN;

N1Str=JOptionPane.showInputDialog("Enter a number :");
N1=Integer.parseInt(N1Str);
N2Str=JOptionPane.showInputDialog("Enter another number :");
N2=Integer.parseInt(N2Str);

product=N1*N2;

if (N1>0)
PoNoN1=N1+"(POSITIVE)";
else if (N1<0) 
PoNoN1=N1+"(NEGATIVE)";
else
PoNoN1="(NEUTRAL)";

if (N2>0)
PoNoN2=N2+"(POSITIVE)";
else if (N2<0) 
PoNoN2=N2+"(NEGATIVE)";
else
PoNoN2="(NEUTRAL)";

if (product>0)
productStr=product+"(POSITIVE)";
else if (product<0) 
productStr =product+"(NEGATIVE)";
else
productStr="(NEUTRAL)";

OutputPoNoN="First number :" + PoNoN1 + "\n" +
"Second number :" + PoNoN2 + "\n" +
"Product :" + product + productStr; 

JOptionPane.showMessageDialog(null,OutputPoNoN,"Result :",JOptionPane.INFORMATION_MESSAGE);

System.exit(0);
}
}

the result does not determining if the first and second integers are positive/negative/neutral

I have replace a variable instead of using System.out.print ( in the if else code pportion ) so the result will not show in the below of the IDE output view ( I wanted to place it on the show message dialog )

the problem is simple but as a beginner I am having difficulty.
thanks for any help.

PoNoN1=N1+"(POSITIVE)";

You declared PoNoN1 as int, but you probably wanted String.

ps: Java convention is the start all variable names with a lower case letter.

edit - sorry, posted this at the same time as James

int N1, N2, product, PoNoN1, PoNoN2;
PoNoN1=N1+"(POSITIVE)";

You can't store Strings into integers. So declare PoNoN2 as a String, not as an integer. Otherwise use a completely different variable. You have many similar mistakes in your code.

String PoNoN1;
PoNoN1= N1+"(POSITIVE)";

Also, your question didn't make any sense to me. Try to be clear about what you want your program to do, what it is doing, and where you think the problems are in your code. If you can't identify problems in your code, at least paste us some error messages from the compiler, or say where you think trouble might lie, or what you don't understand, etc. Also, name variables according to convention. PoNoN2 is definitely not a good variable name.

PoNoN1=N1+"(POSITIVE)";

You declared PoNoN1 as int, but you probably wanted String.

ps: Java convention is the start all variable names with a lower case letter.

Also, sorry James for posting at the same time as you, but haha @ both mentioning the atrocious variable names.

Oh, and @ OP:

I fixed your program in my editor real quick, and I noticed that you still have another error:

"Product :" + product + productStr;

That isn't going to work. productStr already contains "product" in it, so you're going to get double the numbers in your result that you actually want to be there. You can just use

"Product :" + product;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.