java loan calculator applet help



Share on Google+Share on Google+

java loan calculator applet help
0 Answer(s)      4 years and 5 months ago
Posted in : Java Beginners

Hi, I could use some help correcting a code here. I need to write a Java applet program (together with its html test file) to calculate loan payments. The user will provide the interest rate, the number of years, and loan amount.

this is what I have so far

import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

public class LoanCalculator extends JApplet
implements ActionListener
private JTextField jtfInterestRate = new JTextField(10);
private JTextField jtfYear = new JTextField(10);
private JTextField jtfLoan = new JTextField(10);
private JTextField jtfMonthlyPay = new JTextField(10);
private JTextField jtfTotalPay = new JTextField(10);

private JButton jbtCompute = new JButton("Compute Payment");

public LoanCalculator()


JPanel p1 = new JPanel();
p1.setLayout(new GridLayout(5, 2));
p1.add(new Label("Interest Rate (e.g., 5.5 for 5.5%)"));
p1.add(new Label("Years "));
p1.add(new Label("Loan Amount"));
p1.add(new Label("Monthly Payment"));
p1.add(new Label("Total Payment"));
p1.setBorder(new TitledBorder(
"Enter interest rate, year and loan amount"));

JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout(2));

add(p1, "Center");
add(p2, "South");


public void actionPerformed(ActionEvent e)
if (e.getSource() == this.jbtCompute)
double interest =
int year =
double loanAmount =

Loan loan = new Loan(interest, year, loanAmount);

this.jtfMonthlyPay.setText(String.format("%.2f", new Object[] { Double.valueOf(loan.getMonthlyPayment()) }));
this.jtfTotalPay.setText(String.format("%.2f", new Object[] { Double.valueOf(loan.getTotalPayment()) }));

public static void main(String[] args)
JFrame frame = new JFrame("Loan Calulator");

LoanCalculator applet = new LoanCalculator();

frame.add(applet, "Center");


frame.setSize(350, 250);

The error I keep getting here is at line 71 (Loan loan = new Loan(interest, year, loanAmount); that java cannot find symbol and it points to where Loan is after new.

I've tried adding in a NoClassDefErrorException import and that didn't work. I tried changing the name of the code and that didn't work either. I've even tried adding a public class loan in the main method but I realized then that a class can't be declared twice in the main method.

I know that nothing in the above code indicates that I actually have a Loan class. his implies that you have a Loan class in the file somewhere and it should be in the same directory than How can I correct this error. thanks

View Answers

Related Tutorials/Questions & Answers:
java loan calculator applet help
java loan calculator applet help  Hi, I could use some help correcting a code here. I need to write a Java applet program (together with its html...); that java cannot find symbol and it points to where Loan is after new
loan calculator
loan calculator  code of the loan clculator
base calculator.. - Java Beginners
base calculator..  Help, i need some help about a base calculator.. i don't know how to start
matrix calculator - Java Beginners
matrix calculator  hi..... can you help me in writing source code of matrix calculator in java... i know you are the best you can do it!!! show yourself
calculator - Java Interview Questions
calculator  create calculator by java code  Hi Friend, Please visit the following link: Thanks
base calculator.. - Java Beginners
base calculator..  need some help!!! I cant install jcreator properly?? there's always an error (Error : Invalid path, "C:\Program Files\Java\jre1.6.0_01\bin\javac.exe" -classpath "C:\Program Files\Java\jdk1.6.0_01\bin" -d "C
simple calculator - Java Beginners
simple calculator  how can i create a simple calculator using java codes?  Hi Friend, Please visit the following link: Thanks
calculator in java with stack
calculator in java with stack  i want calcultor with interface in java and in interface there is button called postfix ,,, when the user enter... then result plz help me i have project in it ,,i must make interface like that and every
Calculator  need a simple java program to degin a CALCULATOR without using ADVANCED JAVA....   Calculator in Java Swing
Scientific Calculator - Java Beginners
Scientific Calculator  Develop a scientific calculator using even-driven programming paradigm of Java.? Thanks in ADVANCE  Hi Friend, Please visit the following link:
how can i calculate loan - Java Interview Questions
how can i calculate loan  negotiating a consumer loan is not always form of loan is the discount installment loan, which works as follows. suppose a loan has a face value of 1,000 by 0.15 to yield 225
Java Calculator Program
Java Calculator Program  Hi, so I need to make a program that "works like a calculator". I need to make two versions: 1) I'm given the Expression Class and need to implement the children classes, which are Number, Product, Sum
Simple Java Calculator - Java Beginners
Simple Java Calculator  Write a Java program to create simple Calculator for 4 basic Math operations, Addition, Subtraction, Multiplication and Division. The calculator should simulate the look of handheld calculator containing
java applet problem - Applet
java applet problem  i was doing a program using java applet. I want to make a simple calculator. So i added four labels,textboxes. And 6 buttons...*; import java.awt.*; public class Calculator extends Applet implements
loan repayment
loan repayment  Monthly installment calculation is (Loan Amount / (12 * number of years of year repayment)) + 7% of (loan Amount) In case... % of monthly installment * n A customer can also check the status of the loan
calculator - Java Server Faces Questions
calculator  Some ideas for the project of calculator
Java Calculator program - Java Beginners
Java Calculator program  import java.awt.*; import javax.swing.*; import java.awt.event.*; class Calculator implements ActionListener { int c,n...:// Hope
need help to create applet
need help to create applet  Can u help me..?? I get a task ...and i dont know how to make it... So I hope that u can help me... Here is the task... ~Create an Applet using all Layout Manager(use whatever component in each
How to Write a Calculator Program in Java?
How to Write a Calculator Program in Java? In this Java Tutorial you will learn how to write a Calculator program in Java in easy steps. Calculator program... of Calculator program in Java package Tutorial; import*; class
java applet - Applet
java applet  wants to creat address bar on my java applet.  Hi Applet don't provide a facility to create a address bar directly. You just create a text box. In this text box if you enter any http address
loading Java Applet - Applet
loading Java Applet  Hi, I use the archive tag to download my applet into the Browser It takes too long to load. Can I do it in several steps... control the loading within the applet? thanks
Java Applet
Java Applet   How to add Image in Java Applet? what is getDocumentBase
iPhone EMI Calculator, EMI Calculator for iPhone
Loan Calculator (ALC). The ALC tool informs you about the affordable eligibility... Calc using Affordable Loan Calculator tab. How to use this tool? Using our EMI.... EMAIL On the foot side, three tabs will appear: EMI Calculator, Affordable Loan
Calculator  Dear Friends, I need code (or advice) for to calculate the value based on my policy name,policy value and policy duration for my mini project in jsp-servlet. Help Me to solve. Advance thanks you dear friend
java applet - Applet
java applet  I want to close applet window which is open by another button of applet program. plz tell me!   Hi Friend, Try...:// Thanks
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  what is applet?  Hi Friend, Please visit the following link: Thanks
Swimming Pool Calculator - Java Beginners
Swimming Pool Calculator  When I run the program the login window doesn't appear...Please help 1) import javax.swing.*; import...()); mainFrame = new JFrame("Swimming Pool Volume Calculator"); calcButton = new
Swimming Pool Calculator - Java Beginners
Calculator is one that is very simple to use. As you can see, it is a user... PoolVolume() { mainFrame = new JFrame("Swimming Pool Volume Calculator
java applet
java applet  why java applet programs doesn't contain main method
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java


Advertisement null