Purchase Solution

Java applet

Not what you're looking for?

Ask Custom Question

Your team has been hired as a Java programmer by Real Estates Solutions Inc. Your task is to write a Java applet for their web site that would enable customers to figure out their monthly mortgage payments.

The applet input will be the loan amount, annual percentage rate or APR, and the number of years to pay out the loan. The output will be: the monthly payment amount, the number of payments, the total paid including interest, and total interest paid.

The calculations were provided to you by a real estate agent:

p, loan amount or principal
n, number of payments = payments per year * number of years
i, interest per period = apr/payments per year = apr/12
r, monthly payment amount = principal * interest per period / (1-(1+(interest per period)/100)^(number of payments-1)^2)
Hint: In Java syntax the monthly payment calculation is:

r=((p*(i/100))/(1-(Math.pow((1+(i/100)),(n*(-1))))));
Details:

Please note that your program should accept three inputs:

The loan amount,
Annual percentage rate or APR, and
The number of years to pay out the loan
And calculate four outputs:

The monthly payment amount,
Number of payments,
The total paid including interest, and
Total interest paid

When coding your applet, remember the following:

Your applet needs to extend the Applet (or JApplet) class. Of course, you need to import the appropriate applet package(s).
Your applet needs to have declarations for the fields, labels, components, widgets, etc. that you use in the applet.
There are applet methods that are called automatically by browsers. Make sure you initialize (implement init()) your applet.
You need the code that does the calculation of the interest.
You need to handle the event of pressing the button.
Please create an HTML page that contains the applet tag. In addition to your mortgage calculator commented Java code, you need to provide the HTML page.

Here is an example given to me from a facilitator to create an applet:

--------------------------------------------------------------------------------

mport java.applet.*;
import java.awt.*;
/**
* The HelloWorld class implements an applet that
* simply displays "Hello World!".
*/
public class HelloWorld extends Applet {
public void paint(Graphics g){
// Display "Hello World!"
g.drawString("Hello world!", 50, 25);
}
}

--------------------------------------------------------------------------------

Then you would compile the class and create an HTML page called Hello.htm (ignore the periods, they're there to make the HTML code viewable):

--------------------------------------------------------------------------------

<.HTML>
<.HEAD>
<.TITLE>A Simple Program<./TITLE>
<./HEAD>
<.BODY>

Here is the output of my program:

<.APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25>
<./APPLET>
<./BODY>
<./HTML>

Purchase this Solution

Solution Summary

Write a java applet for their web site that would enable customers to figure out their monthly mortgage payments.

Solution Preview

Please see the attachment.

RESolutions.java is an application. It ...

Purchase this Solution


Free BrainMass Quizzes
C# variables and classes

This quiz contains questions about C# classes and variables.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.