Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part II: Computing Monthly Payment on a Loan - debugging You must complete this exercise and save it for a later assignment Using the same

image text in transcribed
Part II: Computing Monthly Payment on a Loan - debugging You must complete this exercise and save it for a later assignment Using the same Lab-2 Project Name, create a new class. This new class will compute the monthly payment on a loan given the loan duration and APR. Give the class a meaningful name. To compute the monthly payment for a loan we use this formula: m = Po * r * (1 + r)"/((1 + r)"-1) Where m is the monthly payment, is the initial loan amount, r is the monthly interest rate, and a 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. Your main static method will prompt the user to input three parameters I. The initial loan amount, PO 2. The APR (as a percentage). Convert APR to the monthly interest rate, P APR/(12+100) 3. The loan duration in years. Convert the years to months by multiplying by 12. The duration n, in months is n 12'durationinYears Once it gets the inputs, it will calculate the monthly payment and output the results to the console. Below is the main method for this program: public static void main(String args)( string input 30ptionPane. showEnputDialog( Enter initial loan anount: float P0 -Float.parseFLoot (input) str ng Dout . 3pt onrne, thoutuzptetogEnter APR (percentage): +i int r Double.parsedoubLe(input)/12 input - 30pt ionPane. showlnputotalog(Enter duration in years: ) int y Integer, parseInt (input) int n y12.0; float power-Math . pow(y, 1+r); double no.nthlyPayment " perpoer/power-1); Numberformat formatter Numberformat.getcurrency Instonce String output Total Valueforeatter format (nanthlypayment) System.out.printin(output); I. Enter this main-method as it is written. 2. Fix (debug) this program to perform the calculation as described above 3. Test your program usang a S25OOD loan over 6 years with an APR-79. The monthly payment is $42623. Display the output result as you did in the previous exercises, but format the result in US-dollar currency units (Reference your L Lab-1 for how to format the output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn Mysql The Easy Way A Beginner Friendly Guide

Authors: Kiet Huynh

1st Edition

B0CNY7143T, 979-8869761545

More Books

Students also viewed these Databases questions

Question

Determine the amplitude and period of each function.

Answered: 1 week ago