Question

Part II: Computing Monthly Payment on a Loan Start a new Java Project, Give the Project a meaningful name. Write a main method to test a new static method used to compute a monthly payment on a loan. The new static method used to compute the monthly payment for a loan uses this formula: Where m is the monthly payment, Po is the initial loan amount, r is the monthly interest rate, and n is the number of monthly payments. The monthly interest rate is the Annual Percentage Rate divided by 12: r= APR/12. The number of payments, n, is 12 times the loan duration in years The monthly payment on a $25000 loan over 6 years with an APR = 790 is S42623. You should use the Math.pow double base, double exponent) method for this exercise. Be sure to use descriptive names for all modules in this exercise.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

class CalculateIntrest{

static int initialLoanAmount=25000;

static int numberOfMonths=72;

static double intrestRateperMonth=0.5833;

static double monthlyPayment;

public static double payment() {

monthlyPayment=(initialLoanAmount*intrestRateperMonth*Math.pow((1+intrestRateperMonth), numberOfMonths))/(Math.pow((1+intrestRateperMonth), numberOfMonths)-1);

return monthlyPayment;

}

}

public class LoanPayment {

public static void main(String[] args) {

// TODO Auto-generated method stub

double monthlyPayment=CalculateIntrest.payment();

System.out.println("The amount to be paid manthly is "+monthlyPayment);

}

}

Add a comment
Know the answer?
Add Answer to:
Give the project a meaningful name. Write a main method to test a new static method...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The program is in python :) Write a code program to calculate the mortgage payment. The...

    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...

  • JAVA: amortization table: Hi, I have built this code and in one of my methods: printDetailsToConsole...

    JAVA: amortization table: Hi, I have built this code and in one of my methods: printDetailsToConsole I would like it to print the first 3 payments and the last 3 payments if n is larger than 6 payments. Please help! Thank you!! //start of program import java.util.Scanner; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.lang.Math; //345678901234567890123456789012345678901234567890123456789012345678901234567890 /** * Write a description of class MortgageCalculator here. * * @author () * @version () */ public class LoanAmortization {    /* *...

  • How do you write a test class that tests each of the setters and constructors to ensure that the appropriate exception is raised?(Note: sed. Recall that the setter method should be called in the constructor and the edits should not be in the setters, not

     /** * Write a description of class LoanTest here. * */public class Loan {  private double annualInterestRate;  private int numberOfYears;  private double loanAmount;  private java.util.Date loanDate;  /** Default constructor */  public Loan() {    this(2.5, 1, 1000);  }  /** Construct a loan with specified annual interest rate,      number of years and loan amount     */  public Loan(double annualInterestRate, int numberOfYears,double loanAmount){    if(loanAmount <= 0)    {        throw new IllegalArgumentException("loan must be greater than 0");       } ...

  • In C. Thank you! Bank Write a program to calculate the monthly payment on a loan...

    In C. Thank you! Bank Write a program to calculate the monthly payment on a loan given the loan amount, interest rate and the number of years to pay off the loan. Then add a function to print an amortization schedule for that loan. Create a class to save the current balance and the rest of the data as private data. Add member functions to make a payment and to print the amortization report. Use the following class header. Class...

  • 1a) Using the double declining depreciation method for an asset with a useful life of 8...

    1a) Using the double declining depreciation method for an asset with a useful life of 8 years. What is the depreciation expense for year 2 on an asset costing $100,000? 2a) You purchase a home and secure a 30 year equal payment loan for $200,000 at a interest rate of 5.25% APR compounded monthly. After 5 years the interest rate drops to 4.75% APR compounded monthly. The bank is charging 2 points to originate the new loan. How many months...

  • Program Specification: This project involves implementing a Java program that performs a calculation of payments associated...

    Program Specification: This project involves implementing a Java program that performs a calculation of payments associated with loans. The program shall allow a user to enter the following data: annual interest rate the loan (i.e. , number of years), and the loan amount. A GUI like the one below must be used. Loan Calculator Annual Interest Rate: Number of Years Loan Amount: Monthly Payment Total Payment Calculate When the user presses the calculate button, the monthly payment and total amount...

  • A person borrowed $30000 to finance the purchase of a new vehicle. The loan will be...

    A person borrowed $30000 to finance the purchase of a new vehicle. The loan will be paid off in 5 years, and the borrowing interest rate is 6%. The person is required to make monthly payments to the loan. What is the amount of monthly payment? N (number of loan payments) =    I (monthly interest rate) =   % PV (amount borrowed) = FV (ending loan balance) =    PMT (required monthly payment) =

  • You need a new car. You can either lease or buy the car for 365 000...

    You need a new car. You can either lease or buy the car for 365 000 SEK. In both cases you expect to use the car for 5 years. It will have a residual value of 120 000 SEK after 5 years. You can borrow at a rate of 3.5% APR with monthly compounding. (a) In case you buy the car you will take an annuity loan over 5 year at a borrowing rate of ${col}%. What will be your...

  • You need a new car. You can either lease or buy the car for 365 000...

    You need a new car. You can either lease or buy the car for 365 000 SEK. In both cases you expect to use the car for 5 years. It will have a residual value of 120 000 SEK after 5 years. You can borrow at a rate of 3.5% APR with monthly compounding. (a) In case you buy the car you will take an annuity loan over 5 year at a borrowing rate of ${col}%. What will be your...

  • Write a python program for the below question? Car Loan If A dollars is borrowed at...

    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.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT