/* See the source code*/
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
import java.awt.*;
class Solution extends JFrame
{
JLabel LblRate; //Label for Interest Rate
JLabel LblYear; //Label for Number of Year
JLabel LblAmount; //Label for Loan Amount
JLabel LblMPayment; //Label for Monthly payment
JLabel LblTPayment; //Label for Total Payment
JTextField TxtRate; //TextFiled for interst
JTextField TxtYear; //TextFiled for Years
JTextField TxtAmount; //TextFiled for Loan amount
JTextField TxtMPayment; //TextFiled for Monthly Payment
JTextField TxtTPayment; //Textfield for Total Payment
JButton BtnCalculate; //Button to calculate
Container c;
public Solution()
{
//Initialize all components
c=getContentPane();
c.setLayout(null);
int w=150,h=20,col=30,row=5;
BtnCalculate = new JButton("Calculate"); BtnCalculate.setBounds(col+180,row+110,w-30,h);
LblRate = new JLabel(); LblRate.setText("Annual Interest Rate:"); LblRate.setBounds(col,row,w,h);
LblYear = new JLabel(); LblYear.setText("Number of Years:"); LblYear.setBounds(col,row+20,w,h);
LblAmount = new JLabel(); LblAmount.setText("Loan Amount"); LblAmount.setBounds(col,row+40,w,h);
LblMPayment = new JLabel(); LblMPayment.setText("Monthly Payment:"); LblMPayment.setBounds(col,row+60,w,h);
LblTPayment = new JLabel(); LblTPayment.setText("Total Payment:"); LblTPayment.setBounds(col,row+80,w,h);
TxtRate = new JTextField(); TxtRate.setBounds(col+150,row,w,h);
TxtYear = new JTextField(); TxtYear.setBounds(col+150,row+20,w,h);
TxtAmount = new JTextField(); TxtAmount.setBounds(col+150,row+40,w,h);
TxtMPayment = new JTextField(); TxtMPayment.setEditable(false); TxtMPayment.setBounds(col+150,row+60,w,h);
TxtTPayment = new JTextField(); TxtTPayment.setEditable(false); TxtTPayment.setBounds(col+150,row+80,w,h);
//Add all components to layout
c.add(LblRate);
c.add(TxtRate);
c.add(LblYear);
c.add(TxtYear);
c.add(LblAmount);
c.add(TxtAmount);
c.add(LblMPayment);
c.add(TxtMPayment);
c.add(LblTPayment);
c.add(TxtTPayment);
c.add(BtnCalculate);
BtnCalculate.addActionListener(new BtnClick());
setSize(400,250);
setTitle("Tax Calculation");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
private class BtnClick implements ActionListener
{
//Set action on calculate button click
public void actionPerformed(ActionEvent ae)
{
//Get values & calculate based on given formula
float interest = Float.parseFloat(TxtRate.getText());
interest*=0.01;
interest/=12;
float years = Float.parseFloat(TxtYear.getText());
years*=12;
float amount = Float.parseFloat(TxtAmount.getText());
float monthlyPayment = (interest*amount)/(1-(float)Math.pow((1+interest),-years));
//Print the result
String formatedValue = String.format("%.2f", monthlyPayment);
TxtMPayment.setText(formatedValue);
formatedValue = String.format("%.2f", (years*monthlyPayment));
TxtTPayment.setText(formatedValue);
}
}
//Main method to run the application
public static void main(String arg[])
{
Solution obj = new Solution();
}
}
/* See the output*/
Program Specification: This project involves implementing a Java program that performs a calculation of payments associated...
The program is in python :) Write a code program to calculate the mortgage payment. The equation for calculating the mortgage payment is: M = P (1+r)n (1+r)n-1 Where: M is your monthly payment P is your principal r is your monthly interest rate, calculated by dividing your annual interest rate by 12. n is your number of payments (the number of months you will be paying the loan) Example: You have a $100,000 mortgage loan with 6 percent annual...
MATLAB!!! CAN SOMEONE SOLVE THIS PROBLEM ON MATLAB?? THANK YOU PART B: HOUSING LOAN CALCULATOR In this part of the assignment, you are expected to develop a program that calculates housing loan pay- ments based on compound interest formulas The program should prompt a user to input the amount borrowed (principal), p, the number of monthly payments, n, and an annual interest rate in R percent. The program should convert the annual interest rate R into a monthly interest rate...
19. Monthly Payments The monthly payment on a loan may be calculated by the following formula: Rate (1Rate) ((1 Rate)N - 1) Payment - Rate is the monthly interest rate, which is the annual interest rate divided by 12" (12% annual interest would be 1 percent monthly interest.) N is the number of payments, and L is the amount of the loan. Write a program that asks for these values and displays a report similar to Loan Amount: Monthly Interest...
using Matlab program: Create a loan payment program that can be used for any loan amount such as a home or car loan. The program should ask the user for the input values below, compute the monthly payment, then compute the monthly balance. Display the balance in a table Month Balance 1 $ ##.## 2 $ ##.## 3 $ ##.## . . . etc Use the formula PMT=P*(r(1+r)^n)/((1+r)^n-1) PMT = the monthly payment. P = the principal r = the interest rate per month, which...
My library>CptS 111 home> 2.9: zyLab PA #1: Student Loan R oks zyBooks cat @Help/FAQ θ Mohammed Al Shukaili 2.9 zyLabPA#1:Student Loan RepaymentCalculator For this assignment you wil write a program to calculate the monthly payments required to pay back a student loan You vill need to prompt the user for the following values Annual interest rate (as a percentage) Number of years to repay loan . and display the output in a readable form. Output should include Amount of...
Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print the sum of the numbers and their average. Q2. The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of...
c++ and please add tables and everything and make sure program is complete. Write a menu driven program, which would compute compound interest and a monthly payment for a loan. The user will be given a choice to display the info on the screen or to a filo Menu will be the following Enter (1) to calculate your loan monthly payment Enter (2) to calculate your loan monthly payment & write to a file Tips: Compound Interest Formula A =...
Write a python program for the below question? Car Loan If A dollars is borrowed at r% interest compounded monthly to purchase a car with monthly payments for n years, then the monthly payment is given by the formula monthly payment = i / 1 - (1 + i)-12n . A where i = r/1200. Write a program that calculates the monthly payment after the user gives the amount of the loan, the interest rate, and the number of years.
You wish to buy a car for $12,000 at a 5% annual interest rate, compounded monthly. The loan will be repaid in 5 years with monthly payments. What is your monthly payment (calculated with the equations on the next page)? Compare your answer to that obtained with the built in function, PMT. Be sure to label all cells appropriately. (There is no need to create a monthly payment table, simply use the equations on the next page.) Loans: where: and,...
Devise an app (use a GUI) to calculate and display loan repayments. The user will enter in a loan amount, term and interest rate. You calculate the periodic amount due and display it to the user. The formula you need is below. A=P{\frac {i(1+i)^{n}}{(1+i)^{n}-1}}={\frac {P\times i}{1-(1+i)^{{-n}}}}=P\left(i+{\frac {i}{(1+i)^{n}-1}}\right) where: A = periodic payment amount P = amount of principal i = periodic interest rate e.g. 7.5% per year / 12 months = 0.625% per period n = total number of payments...