Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete Java program, including comments, to do the following: Your program will compute the monthly payment (monPayment - double) on a mortgage

image

Write a complete Java program, including comments, to do the following: Your program will compute the monthly payment (monPayment - double) on a mortgage of amount principal (integer), with interest rate intRate (double) for numYears (integer) number of years. The formula is written as follows: monPayment = principal* (intRate/12)*(1+(intRate/12))numYears 12 ((1+(intRate/12))num Years*12)-1 For example if principal-$100,000, intRate=.07 and numYears-30 years then the monthly payment is $665. Check that your code yields the same number before you go any further. Use the pow function to raise a number to a power. Math.pow(10,5) means 10 to the 5th power. To raise a*b to the power of c*d use Math.pow(a*b, c*d). 1. The program should start by printing a header giving your name, class/section and assignment number. Use a loop to print underscores (_) as a horizontal line to add clarity to the report (see sample output below). 2. The program will compute the monthly payment of loans starting at $100,000 up to an including $1,000,000 (in increments of $100,000) at 7 different interest rates (starting at .07 up to and including .1 in increments of .005). The outer loop will run from 100000 to 1000000 and the inner loop from .07 to .1 and the formula for computing the monthly payment will be part of the inner loop 3. Use a printf statement for the column header, allowing 3 decimal places for the interest rate. The total field size for intRate should match what you use for the monthly payment (in the section below) 4. Use printf statements for: (a) the principal having no decimal places and max size of 7 positions and (b) monthly payment containing 2 decimal places and up to 4 positions to the left of the decimal place. Align all numbers to the right and align the monthly payments with the interest rate header above it. Edit View Insert Format Tools Add-ons Help Last edit was seconds ago AT 100% Normal text Verdana 14 +BIU A 112.1.3. 14 1.51 61 7 EEE 1.9 10 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 19 20 4. Use printf statements for: (a) the principal having no decimal places and max size of 7 positions and (b) monthly payment containing 2 decimal places and up to 4 positions to the left of the decimal place. Align all numbers to the right and align the monthly payments with the interest rate header above it. The final result should look as follows. Your numbers and alignment should match exactly what appears below. Also, when you copy the output, the font should be Courier New or any other fixed font so that the columns will line up properly. Be sure to comment your program. Principal CISC 1115 TR11 Homework 4A 0.070 0.075 Interest Rate 0.080 0.085 0.090 0.095 0.100 100000 665.30 200000 1330.60 1995.90 300000 699.21 733.76 1398.43 1467.53 2201.29 2097.64 804.62 768.91 1537.83 1609.24 2306.74 2413.86 840.85 1681.71 2522.56 877.57 1755.14 2632.72 5870.12 800000 5322.41 5593.71 900000 5987.71 6292.92 6603.88 7337.65 1000000 6653.01 6992.14 6151.31 6436.97 6920.23 7241.59 7689.14 8046.22 6726.83 7020.58 7567.69 7898.15 8408.54 8775.72 DELL

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

Students also viewed these Programming questions

Question

How Does the Economy Balance Supply and Demand?

Answered: 1 week ago