Write a complete Java program, including comments, to do the following: Your program will compute the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
The statement of financial position of Kingbird Limited follows for the current year, 2020: KINGBIRD LIMITED Statement of Financial Position December 31, 2020 Current assets $135,660 Current...
-
Discuss the three categories of vacation home rentals. Include in your discussion how personal use of the property affects the reporting of income and losses of vacation homes.
-
Treatment of hydroxylamine (H2NOH) with an excess of Fe(III) results in the formation of N2O and an equivalent amount of Fe(II): 2H2NOH + 4Fe3+ ( N2O(g) + 4Fe2+ +4H+ + H2O
-
In quantum mechanics, what is the difference between positive (constructive) and negative (destructive) interference?
-
Lansing Companys 2015 income statement and selected balance sheet data (for current assets and current liabilities) at December 31, 2014 and 2015 follow. Required Prepare the cash flows from...
-
Use Euclid's Algorithm to calculate GCD(1424, 3084), 30841424 3084 2.1424 +236 1424 6.236 +8 236 29.8+4 8=2.4+0 GCD (1424, 3084) = 4 Draw your flowchart for finding the GCD of X and Y. You may assume...
-
25. A ball is thrown upward with a speed of 38.0 m/s from the top of a building 240. meters tall; a. What will be the velocity of this ball at the highest point? * b. How long will it take for this...
-
Order the rational numbers from least to greatest in each part. (a) 3 7 4'16 (Use a comma to separate answers as needed.)
-
Evaluate the function. f(-2) = f(x) = 2.8(4)x + 1 + 9.5, for f(-2)
-
Solve the equation. Check the solution. K 7 (4x-1)= 4 9 9
-
Simplify. (-10x) (-3x) (153x-9) (-10x) (-3x) (x) = [ 1 (Use positive exponents only.)
-
Simplify the expression. -62+ (-45) (-3)
-
Do you think that Freuds ideas are slightly sexist?
-
Which provision could best be justified as encouraging small business? a. Ordinary loss allowed on $ 1244 stuck. b. Percentage depletion. c. Domestic production activates deductions. d. Interest...
-
Which are qualitative and which are quantitative? a. The number of patients admitted to a hospital on a given day b. The model of car last sold by a particular car dealer c. The name of your favorite...
-
Is the color of a smartphone nominal or ordinal?
-
A pollster wants to estimate the proportion of voters in a certain town who are Democrats. He goes to a large shopping mall and approaches people to ask whether they are Democrats. Is this a simple...
Study smarter with the SolutionInn App