As off topic as they come, java!

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!
 
Well it only took me like an hour, I found out it was a comma after years that was supposed to be a semicolon. Have a good night everyone!
 
I wish I would have seen this last night. I could have saved you 2 hours. At least you caught it. :bigups
 
Back
Top