Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements: Program must compile with both -Wall and -Werror options enabled Submit only the files requested Use doubles to store real numbers Print all doubles

Requirements:

  • Program must compile with both -Wall and -Werror options enabled
  • Submit only the files requested
  • Use doubles to store real numbers
  • Print all doubles to 2 decimal points unless stated otherwise

Problem Description

Loans can be rather expensive in the long run so it is important to figure out how much money you will be paying each month as well as the total cost of the loan. The formula for calculating the periodic payment of the loan is

where

  • P is the principal (amount of money borrowed)
  • i is the interest rate
  • n is the total number of payments

Your program should ask the user for the following in this order

  1. The amount they are borrowing
  2. The annual interest rate
    1. We will be assuming that the payments are being made monthly so the actual interest to use is 1/12 of the annual interest
  3. The number of payments to be made

After collecting the above information your program reports the monthly payment as well as the total cost of the loan.

Assumptions

  • All input is valid
  • As stated before, we will be assuming that payments are made monthly (the norm) and so you will want to use 1/12 of the annual interest in your calculations
  • The examples provided do not represent all possible input you can receive
    • So make sure to test thoroughly on your machine

Additional Notes

  • You will need to use the pow function in this assignment so don't forget to include math.h and compile with -lm.

Examples

In the examples below user input has been underlined. You don't have to do any underlining in your program. It is just there to help you differentiate between what is input and what is output.

Example 1

Please enter the amount of money you borrowed: $1000

Please enter the annual interest rate: .05

Please enter the number of payments to be made: 12

A loan of $1000.00 with an annual interest of 0.05 payed off over 12 months will have monthly payments of $85.61.

In total you will pay $1027.29, making the cost of your loan $27.29.

Example 2

Please enter the amount of money you borrowed: $60000

Please enter the annual interest rate: .07

Please enter the number of payments to be made: 120

A loan of $60000.00 with an annual interest of 0.07 payed off over 120 months will have monthly payments of $696.65.

In total you will pay $83598.11, making the cost of your loan $23598.11.

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions