*
*

The program is started here. Write the rest of the program, and demo it to a TA in your lab section.

The program asks the user for the equationâ€™s real coefficients

Assume all values are real (i.e. non-complex), and that coefficient

**Exercise 2:** Write a program that computes, and displays, two sums:

- the sum of the squares of numbers 1 through 10

- the sum of the square roots of numbers 1 through 10

You must only use a single loop structure for the two sums. Demo it to a TA.

* 1 2 3 4 5 1 1 2 3 4 5 2 2 4 6 8 10 3 3 6 9 12 15No need to check for 'crazy inputs' here (so you may assume that the user will always enter two reasonable integers). Just concentrate on the nested loops and the formatting. Use the

A mortgage is quite simple. The bank loans you a certain amount of money (the principal) to purchase a house at a certain interest rate.
Every month, you must make a payment to reduce the balance. In addition, the bank charges interest by computing one twelfth of the (annual) interest rate times the remaining balance, increasing the balance due (side note: unfortunately, the interest gets charged *before* your payment is applied).

Some loans are for a fixed amount of time, and the monthly payment is then calculated as a function of the initial loan amount and the interest rate. Other loans are determined by a desired monthly payment (if the borrower wants to control his/her cash flow), and the total time of the loan is then computed based on the initial loan amount and the desired monthly payment. In this problem, we will assume the latter.

For example, suppose that you borrow $100,000 to purchase a home at 5 percent yearly interest. You agree to pay $500 per month until the mortgage is paid off. In the first month, the interest increases the balance by $416.67, then your payment reduces it by $500, for a remaining balance of $99,916.67. The first payment only reduced the principal by $83.33! In the second month, the interest charge is $416.32, and the remaining balance is $99,832.99. And so on. If you keep computing like this, you get what is known as an *amortization table* that shows every payment until the mortgage is paid off (as you can deduce, most of the interest is paid early on).

Month Payment Interest Balance 1 $500.00 $416.67 $ 99916.67 2 $500.00 $416.32 $ 99832.99 ... 430 $500.00 $ 3.97 $ 457.01 431 $458.84 $ 1.90 $ 0.00

Your job is to write a program called `mortgage.cpp` that asks the user to input 3 values: the *principal*, the *interest rate*, and the *desired monthly payment*; and the program then displays an amortization table. At the end, the program should also display how long it took to pay off the mortgage (in years and months) as well as the total amount of payments over that time. For example:

You paid a total of $215458.92 over 35 years and 11 months.

*(Note: The values in the example above were calculated by using a float to represent
the balance, so you will notice some oddities in the rounding, as the
program is keeping track of sub-cent values. Your bank has some specific
rules for rounding off cents on each calculation, but we won't get into
that level of detail.)*

Once you have the basic calculation working, add the following refinements:

Pick a non-trivial function with possible multiple maxima and minima that makes an interesting pattern. It could be a high-degree polynomial or some combination of transcendental functions.

As a simple example, here is the output for:
10.0*(1.0+sin(x))

Use any character of your choosing for display. A "*****"
or a "**#**" is a common choice.

Select a range that shows some interesting behavior. Use `iomanip` to limit the displayed precision and line up the columns nicely.

` #include <iomanip> `

You can see some of its functions and some examples in section 7.3 of your zybooks.

All files must be submitted to your *lab2* directory under the course dropbox (make sure you've created it!).

Make sure you follow the guidelines from the general instructions for turning in.