jdubb5005
Egad look at that shine.
Hey I am learning how to write some java for class and I was wondering if anyone can help me out. I will enter my code and then i will enter the error message i receive. The program is not complete, but it should compile and allow a message box to come up.
CODE:
import javax.swing.*;
import static java.lang.Math.*;
import static javax.swing.JOptionPane.*;
class Mortgage
{
public static void main (String [] args)
{
String
principalString,
interestRateString,
yearsString;
double
principal,
interestRate,
monthlyPayment;
int
years,
principalString = showInputDialog
("Input the principal: ");
principal = Double.parseDouble (principalString);
}
}
ERROR:
Mortgage.java:20: principalString is already defined in main(java.lang.String[])
principalString = showInputDialog
^
Mortgage.java:21: incompatible types
found : java.lang.String
required: int
("Input the principal: ");
^
2 errors
Thanks!
CODE:
import javax.swing.*;
import static java.lang.Math.*;
import static javax.swing.JOptionPane.*;
class Mortgage
{
public static void main (String [] args)
{
String
principalString,
interestRateString,
yearsString;
double
principal,
interestRate,
monthlyPayment;
int
years,
principalString = showInputDialog
("Input the principal: ");
principal = Double.parseDouble (principalString);
}
}
ERROR:
Mortgage.java:20: principalString is already defined in main(java.lang.String[])
principalString = showInputDialog
^
Mortgage.java:21: incompatible types
found : java.lang.String
required: int
("Input the principal: ");
^
2 errors
Thanks!