2010-04-25 22:48:03 UTC
mortgage = Double.parseDouble(strMortgage);
Here's my code...
import javax.swing.*;
import java.io.*;
import java.lang.*;
public class DebtRatio
{
public static void main(String[] args)
{
String strMonthlyIncome;
String strMortgage;
String strAutoLoan;
String strOtherDebt;
Double monthlyIncome;
Double mortgage;
Double autoLoan;
Double otherDebt;
Double ratio;
//Input Section
System.out.println("Debt Ratio Calculator");
strMonthlyIncome= JOptionPane.showInputDialog(null,"Enter your monthly payment");
strMonthlyIncome= JOptionPane.showInputDialog(null,"Enter your mortgage");
strAutoLoan= JOptionPane.showInputDialog(null,"Enter your autoLoan");
strOtherDebt= JOptionPane.showInputDialog(null,"Enter other debt");
//Conversion
monthlyIncome = Double.parseDouble(strMonthlyIncome);
mortgage = Double.parseDouble(strMortgage);
autoLoan = Double.parseDouble(strAutoLoan);
otherDebt = Double.parseDouble(strOtherDebt);
//Calculation
ratio = ((mortgage + autoLoan + otherDebt) / monthlyIncome);
//Output
System.out.println("Your Debt Ratio is" + ratio);
}
}