Here is my code so far. I'm not sure what I'm doing wrong, but I cannot get it to compile. Incompatible Types (Lines 90 - 92) . Please Please Help. My ultimate task is to write an Applet Mortgage Calculator.
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
public class MortgageCalc extends JApplet implements ActionListener
{
Container con = getContentPane();
JLabel Greet = new JLabel("Estimate Mortgage Payments \n");
Font headlineFontg = new Font("Helvetica", Font.BOLD, 28);
JLabel Mortgage = new JLabel ("Amount of Mortgage: \n");
Font headlineFont = new Font("Helvetica", Font.BOLD, 12);
JTextField answer = new JTextField(10);
JLabel Interest= new JLabel("Interest Rate as % (e.g. 7.9): \n");
Font headlineFonta = new Font("Helvetica", Font.BOLD, 12);
JTextField answera = new JTextField(10);
JLabel Time = new JLabel("Number of Years: \n");
Font headlineFontb = new Font("Helvetica", Font.BOLD, 12);
JTextField answerb = new JTextField(10);
JLabel MonthPay = new JLabel("Monthly Payment: \n");
Font headlineFontc = new Font("Helvetica", Font.BOLD, 12);
JTextField MoPay = new JTextField(10);
JLabel MonthPaya = new JLabel(" - - ");
Font headlineFontd = new Font("Helvetica", Font.BOLD, 12);
JButton Calculate = new JButton("Calculate");
JButton Reset = new JButton("Reset");
public void init()
{
Greet.setFont(headlineFontg);
con.add(Greet);
Mortgage.setFont(headlineFont);
con.add(Mortgage);
con.add(answer);
con.setLayout(new FlowLayout());
answer.addActionListener(this);
Interest.setFont(headlineFonta);
con.add(Interest);
con.add(answera);
con.setLayout(new FlowLayout());
answera.addActionListener(this);
Time.setFont(headlineFontb);
con.add(Time);
con.add(answerb);
con.setLayout(new FlowLayout());
answerb.addActionListener(this);
MonthPay.setFont(headlineFontc);
con.add(MonthPay);
con.add(MoPay);
con.setLayout(new FlowLayout());
MoPay.addActionListener(this);
MonthPaya.setFont(headlineFontd);
con.add(MonthPaya);
con.setLayout(new FlowLayout());
con.add(Calculate);
con.add(Reset);
}
public void actionPerformed(ActionEvent e)
{
int Mort;
int Int;
int T;
Mort = answer.getText();
Int = answera.getText();
T = answerb.getText();
MonthPay.setText( "$" + (Int - (Mort * Int * T)) / (T*12));
}
}