Project #6 – Amy’s Auto Loan Payments
1 Problem Overview
You are a consultant doing work for Amy’s Autos, a small car dealership. Amy wants a program that lets her staff enter basic loan data (amount, interest rate) and show the potential buyer various financing options, including a report showing a monthly payment breakdown.
2 User Interface
2.1 Initial Input
The user is first asked for the loan amount and annual interest rate: Enter loan amount, example 10000:
20000 Enter annual interest rate, example 2.9:
These are used for all further calculations.
2.2 Input Menu
The user is then shown a menu offering various loan terms from which they can choose
Amy's Auto - Loan Report Menu
1. | 12-month | loan |
2. | 24-month | loan |
3. | 36-month | loan |
4. | 48-month | loan |
5. | 60-month | loan |
0. | EXIT |
Choice:
2.3 Output
Once the user chooses a loan term option from the menu, they get a nicely formatted report showing one line per payment the buyer will make (abbreviated for space’s sake, here):
Pmt# | PmtAmt | Int | Princ | Balance | |||
1 | 1,692.96 | 48.33 | 1,644.63 | 18,355.37 | |||
2... | 1,692.96 | 44.36 | 1,648.60 | 16,706.77 | |||
11 | 1,692.96 | 8.15 | 1,684.81 | 1,688.90 | |||
12 | 1,692.98 | 4.08 | 1,688.90 | 0.00 | |||
20,315.54 | |||||||
Press | <Enter> to | continue | |||||
Once the user presses <Enter>, the menu of term options is once again displayed.
3 Functions
3.1 Call Hierarchy
Function Name | Parameters | Returns | Description |
main | none | none | · Calls inputLoanData to gather loan info· Sets up a loop that calls functions that display the menu and chosen reports· The loop ends when it sees the menu return a loan term of 0 months |
inputLoanData | none | Loan amount1,Interest rate per period | · Asks the user for the basic loan info |
showMenu | none | Number of periods | · In a loop, displays the loan term menu and asks for a user choice· If the user makes a valid choice, it returns the number of periods· If the user makes an invalid choice, the menu simply displays again· If the user chooses the Exit option (choice 0), it returns a loan period of 0 months as a signal to the callingfunction that the user wants out |
payment | PV, Rate per period2, Numberof periods3 | Payment amount | · Calculates the payment as shown in the Calculations section below |
showReport | PV, Rate per period, Number of periods, Payment amount | None | · Displays an attractive, aligned report showing the payment breakdown (which it calculates as shown below)· After the report, displays a message asking the user to press <Enter> to continue |
1 This is also used as PV, the present value of the loan.
2 This is also known as the periodic interest rate.
3 We’re talking about monthly payments, so for our purposes “periods” = “months” throughout this project.
4 Calculations
Here are the key calculations you’ll need to use:
r(PV)
𝑃 = 1 − (1 + 𝑟)−𝑛
Adjust the last payment, principal, and balance to take care of any small amount left after the last payment has been calculated (note the last line of the report above). Sum the payments and display that result at the bottom of the report (as shown above).
5 Code Specifications
every line needs a comment; think about describing a block of related code.
6 Hints
you’re up for the challenge. Don’t use tabs and spaces for alignment; you know better, now.
7 Testing
8 Summary
At the bottom of your program, add comments that answer these questions:
to fix as you learn more?
9 Grading Matrix
Area | Percent |
Plain (non-looping) menu | 20 |
Add looping menu | 20 |
Input validation | 20 |
Calculations correct | 20 |
Test cases | 10 |
Internal documentation | 5 |
Summary report | 5 |
Total | 100 |
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of