Due Date
See the
calendar for due date.
Description:
Write a Fortran program that calculates information regarding a loan. In particular, calculate the following:
- Monthly payment schedule (only display the first and last years)
- Total amount paid
- Total interest paid
Prompt the user to enter the name of a file that has loan terms in the following format:
Initial_Loan1 Number_of_years1 Annual_interest_rate1
Initial_Loan2 Number_of_years2 Annual_interest_rate2
Initial_Loan3 Number_of_years3 Annual_interest_rate3
...
where entries are separated with white space (
e.g., tabs).
There will be between 1 and 10 loan terms per file.
As an example, see
loanTerms.tab.
Calculate the payment schedule for each set of loan terms in the file (each line is a different set of loan terms).
To simplify your calculations, compound interest monthly and include partial cents.
Your program needs to use at least one function or subroutine.
Additionally, create a git (or SVN) repository (follow standard folder naming conventions) for this project and check in your code at the following milestones:
- After writing comments to outline the major portions of the code
- After adding in a makefile
- After your program successfully reads in the loan terms and displays that information
- After your program calculates the monthly payment and displays that information
- After your program correctly calculates the first year of payments
- After your program correctly displays the total interest and total payments
Make your repository available for me to check out your project.
After the program works correctly, write a brief report (less than a page) in LaTeX that includes the following:
- A quick synopsis of your algorithm
- How you validated your results
- Difficulties encountered
- Instructions for how I can checkout your project from your repository (including any a password if required)
- The number of hours spent
Example
Here's an example of correct execution (with user input in
bold) (see
loanCalculator-stdout-refiOptions.txt):
Please enter the name of a loan terms file: refiOptions.tab
You entered refiOptions.tab
Loan #1
Initial Balance: $ 170000.00
Years to Pay: 15
Interest Rate: 2.875%
Monthly Payment: $ 1163.80
Period Principal Interest Balance
1 756.50 407.29 169243.50
2 758.32 405.48 168485.18
3 760.13 403.66 167725.05
4 761.95 401.84 166963.09
5 763.78 400.02 166199.31
6 765.61 398.19 165433.70
7 767.44 396.35 164666.26
8 769.28 394.51 163896.97
9 771.13 392.67 163125.85
10 772.97 390.82 162352.88
11 774.83 388.97 161578.05
12 776.68 387.11 160801.37
169 1130.85 32.94 12619.62
170 1133.56 30.23 11486.06
171 1136.28 27.52 10349.78
172 1139.00 24.80 9210.78
173 1141.73 22.07 8069.06
174 1144.46 19.33 6924.59
175 1147.21 16.59 5777.39
176 1149.95 13.84 4627.43
177 1152.71 11.09 3474.72
178 1155.47 8.32 2319.25
179 1158.24 5.56 1161.01
180 1161.01 2.78 0.00
Total Interest: $ 39483.23
Total Payments: $ 209483.23
Loan #2
Initial Balance: $ 170000.00
Years to Pay: 20
Interest Rate: 3.000%
Monthly Payment: $ 942.82
Period Principal Interest Balance
1 517.82 425.00 169482.18
...
Rubric:
Points Item
----------- --------------------------------------------------------------
_____ / 10 Repository
_____ / 10 Makefile
_____ / 15 Program: Read from file
_____ / 10 Program: Function and/or subroutine
_____ / 25 Program: Monthly payment schedule (first & last years)
_____ / 10 Program: Total amount and total interest
_____ / 5 Program: Output format
_____ / 5 Report: Algorithm synopsis
_____ / 5 Report: Validation
_____ / 5 Report: Difficulties
_____ / 5 Report: Hours
_____ / 105 Total
_____ Approximate number of hours spent
Submission
Place the following in a tarball and submit the tarball into the appropriate folder in the dropbox for COMS 6100 at
https://elearn.mtsu.edu:
- A makefile that will compile your code correctly
- Fortran source code
- Plain-text output of the program running (e.g., redirect the output of the program using ">")
- PDF of your brief LaTeX write-up
- Completed rubric (estimates for each line including hours spent)
To make a tarball, do something like the following:
tar -czf hwkLoanCalculator.tar.gz hwkLoanCalculatorDirectory/
Hints
- Start small. Get something working then add to it. For example, if you're not an expert at writing functions/subroutines, then write a very simple one in a very simple program. Verify that it works correctly. Then, add it to your assignment and verify that it's still working. Then, add more functionality/complexity to your function/subroutine and verify that it is still working correctly.
- Part of the grading process is automated by using diff. You should verify that your output matches the above output exactly with the following commands on herschel:
make
scp $USER@ranger0.cs.mtsu.edu:/nfshome/hcarroll/public_html/6100/assignments/refiOptions.tab .
echo "refiOptions.tab" | ./loanCalculator &> loanCalculator-yourlastname.txt
scp $USER@ranger0.cs.mtsu.edu:/nfshome/hcarroll/public_html/6100/assignments/loanCalculator-stdout-refiOptions.txt .
diff loanCalculator-stdout-refiOptions.txt loanCalculator-yourlastname.txt
If the two files match exactly (which is what you want) then there should be NO output from diff. If diff shows one or more differences, fix them and run it again. To get side-by-side output (with the answer key on the left and your output on the right), replace the last line with:
diff --side-by-side loanCalculator-stdout.txt loanCalculator-yourlastname.txt
For details about interpreting the output of diff, see the Using diff section on the Misc. webpage.