Need help rounding. MoPay.setText is showing up as .########### (I'm new to this language.) Oh, and my dollar sign isn't showing up, does anyone no why?

public void actionPerformed(ActionEvent e)
{
int Mort;
double Int;
int T;


if(e.getSource()==Reset)
{
answer.setText("");
answera.setText("");
answerb.setText("");
MoPay.setText("");
}


else if(e.getSource()==Calculate)
{
try {
Mort = Integer.parseInt(answer.getText());
Int = Double.parseDouble(answera.getText());
T = Integer.parseInt(answerb.getText());
MoPay.setText("$" + (Int - (Mort * Int * T)) / (T*12));


}
catch(java.lang.NumberFormatException NFE)
{
Mort = 0;
Int = 0;
T = 0;
}
}
}

If I were you I'd start with using proper Java naming conventions, so variable and method names using CamelCase and starting with a lowercase letter, class and interface names similar but starting with an uppercase letter.
Also use meaningful names for your variables and members to make it easier to comprehend what's going on.

What is "Calculate", what is "Reset", etc. etc.?
Are you sure you're intending to use a comparison of the reference values there rather than a comparison of content?
Are you sure that your math is correct? Isn't there an implicit cast somewhere which is causing you to loose precision?

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.