forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoan.java
More file actions
executable file
·79 lines (77 loc) · 2.29 KB
/
Loan.java
File metadata and controls
executable file
·79 lines (77 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* */ package ch10;
/* */
/* */ import java.util.Date;
/* */
/* */ public class Loan
/* */ {
/* */ private double annualInterestRate;
/* */ private int numberOfYears;
/* */
/* */ public Loan() {
/* 11 */ this(2.5D, 1, 1000.0D);
/* */ }
/* */
/* */
/* */ private double loanAmount;
/* */ private Date loanDate;
/* */
/* */ public Loan(double annualInterestRate, int numberOfYears, double loanAmount) {
/* 19 */ this.annualInterestRate = annualInterestRate;
/* 20 */ this.numberOfYears = numberOfYears;
/* 21 */ this.loanAmount = loanAmount;
/* 22 */ this.loanDate = new Date();
/* */ }
/* */
/* */
/* */ public double getAnnualInterestRate() {
/* 27 */ return this.annualInterestRate;
/* */ }
/* */
/* */
/* */ public void setAnnualInterestRate(double annualInterestRate) {
/* 32 */ this.annualInterestRate = annualInterestRate;
/* */ }
/* */
/* */
/* */ public int getNumberOfYears() {
/* 37 */ return this.numberOfYears;
/* */ }
/* */
/* */
/* */ public void setNumberOfYears(int numberOfYears) {
/* 42 */ this.numberOfYears = numberOfYears;
/* */ }
/* */
/* */
/* */ public double getLoanAmount() {
/* 47 */ return this.loanAmount;
/* */ }
/* */
/* */
/* */ public void setLoanAmount(double loanAmount) {
/* 52 */ this.loanAmount = loanAmount;
/* */ }
/* */
/* */
/* */ public double getMonthlyPayment() {
/* 57 */ double monthlyInterestRate = this.annualInterestRate / 1200.0D;
/* */
/* 59 */ double monthlyPayment = this.loanAmount * monthlyInterestRate / (1.0D - 1.0D / Math.pow(1.0D + monthlyInterestRate, (this.numberOfYears * 12)));
/* 60 */ return monthlyPayment;
/* */ }
/* */
/* */
/* */ public double getTotalPayment() {
/* 65 */ double totalPayment = getMonthlyPayment() * this.numberOfYears * 12.0D;
/* 66 */ return totalPayment;
/* */ }
/* */
/* */
/* */ public Date getLoanDate() {
/* 71 */ return this.loanDate;
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch10/Loan.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/