I have this assignment to create an amortization library:
Amortization is a way to pay off a debt over time with equal payments. Your assignment is to create both a program and a library to handle this problem.
The first part of the problem is to create an "Amort" Library which has at least 3 functions:
doublegetPaymentAmount(), which returns the amount of each monthly payment ("rounded" up to the next cent).
doublegetLoanAmount(), which returns the amount of the entire loan (rounded off to the nearest cent).
intgetNumberOfMonths(), which returns the number of monthly payments to be made ("rounded" up to the next integer).
These functions should each take 3 parameters and return a single value. These functions should not do any I/O!
Giveni, the monthly interest rate represented as a decimal (yearly rate / 1200), you can calculate:
the monthly payment amount; if you know the principal andthe number of monthly payments ("round" up to next cent),
theprincipal (total amount loaned); if you know the payment amount andthe number of months payments are to be made (round off to nearest cent),
the number of months; if you know the payment amount andthe total principal ("round" up to next integer).
The formulae are:
payment= (1 + i) months * principal * i (1 + i) months - 1
principal = (1 + i )months - 1 * paymenti * (1 + i )months
months = log( payment ) - log( payment - (principal * i )) log( 1 + i )
These functions need to be compiled into your new "Amort.lib" Don't forget to create an accompanying "Amort.h" file! Don't forget that ALL functions must have a separate header block!
You will then write a program that helps a users calculate loan payments. You will present a menu of at least three options:
calculate (P)ayment size
calculate (L)oan size
calculate (N)umber of payments
(Q)uit
The user should be able to select an option using either the number or the upper or lower case letter.
If the user selects (1), (P) or (p), prompt for and input:
theannual interest rate >( = 0, round to the nearest 1/8thpoint)
the size of the loan> ( 0, round to the nearest cent)
the number of payments > ( ).
If the user selects (2), (L) or (l), prompt for and input:
theannual interest rate >( = 0, round to the nearest 1/8thpoint)
the size of each payment > (0, round to the nearest cent)
the number of payments > ().
If the user selects (3), (N) or (n), prompt for and input:
theannual interest rate >(= 0, round to the nearest 1/8thpoint)
the size of the loan > (0, round to the nearest cent)
the size of each payment > (0, round to the nearest cent). Do not allow the user to enter a payment size that is less than or equal to an interest-only payment.
If the user selects (4), (Q) or (q), the program should exit
The program should continually re-prompt and allow the user to re-enter any non-numeric or out-of-range values. It should not allow the user to enter Interest values of less than zero. If zero is entered for interest, the function called should be able to properly deal with it (i.e., don't allow division by zero). In none of the other cases should you allow the user to enter values of zero or less.
For all of these inputs, echo back to the user the number the program will actually use (e.g. if the user enters 88.854 for payment, the program should print back: Monthly Payment : $88.85). The program should then display the results in a friendly manner (money values should be printed to two decimal places, percentage to three decimal places, and the number of months should be a whole number).
Finally, unless the user has selected the quit option, the sequence should start over again from the menu (use a loop).
I manage to make my own project with just 1 project and i just realized that ineed to utilize using multiple functions and i manage to get till this far but can't seem to get it working for some reason though:
i make 3 functions with 2 projects each project has Amort.h, 1 project has the Main.c and the other Amort.cpp
Question
atyemail
I have this assignment to create an amortization library:
Amortization is a way to pay off a debt over time with equal payments.
Your assignment is to create both a program and a library to handle this problem.
The first part of the problem is to create an "Amort" Library which has at least 3 functions:
These functions should each take 3 parameters and return a single value.
These functions should not do any I/O!
Given i, the monthly interest rate represented as a decimal (yearly rate / 1200), you can calculate:
These functions need to be compiled into your new "Amort.lib"
Don't forget to create an accompanying "Amort.h" file!
Don't forget that ALL functions must have a separate header block!
You will then write a program that helps a users calculate loan payments. You will present a menu of at least three options:
The user should be able to select an option using either the number or the upper or lower case letter.
Do not allow the user to enter a payment size that is less than or equal to an interest-only payment.
The program should continually re-prompt and allow the user to re-enter any non-numeric or out-of-range values. It should not allow the user to enter Interest values of less than zero. If zero is entered for interest, the function called should be able to properly deal with it (i.e., don't allow division by zero).
In none of the other cases should you allow the user to enter values of zero or less.
For all of these inputs, echo back to the user the number the program will actually use (e.g. if the user enters 88.854 for payment, the program should print back: Monthly Payment : $88.85). The program should then display the results in a friendly manner (money values should be printed to two decimal places, percentage to three decimal places, and the number of months should be a whole number).
Finally, unless the user has selected the quit option, the sequence should start over again from the menu (use a loop).
I manage to make my own project with just 1 project and i just realized that ineed to utilize using multiple functions and i manage to get till this far but can't seem to get it working for some reason though:
i make 3 functions with 2 projects each project has Amort.h, 1 project has the Main.c and the other Amort.cpp
Amort.h:
Amort.cpp:
Main.C:
for the comment it's because i tried using those thing with one project and it work but when it gets to multiple files can't seem to get it working
Link to comment
Share on other sites
4 answers to this question
Recommended Posts