Skip to content

Commit 030bd33

Browse files
test modify markdown code
1 parent 7a825b6 commit 030bd33

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

1_LoanAccount/README.md

+41-41
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,32 @@ Loan1 929.10 585.01 499.25
3030
import java.lang.Object;
3131

3232
public class LoanAccount extends Object {
33-
public static double annualInterestRate;
34-
private double principal;
33+
public static double annualInterestRate;
34+
private double principal;
3535

3636

37-
// constructors
38-
public LoanAccount () {
39-
this(0.0);
40-
}
41-
public LoanAccount (double principal) {
42-
this.principal = principal;
43-
}
44-
// END constructors
37+
// constructors
38+
public LoanAccount () {
39+
this(0.0);
40+
}
41+
public LoanAccount (double principal) {
42+
this.principal = principal;
43+
}
44+
// END constructors
4545

4646

47-
// setters
48-
public static void setAnnualInterestRate (double newInterestRate) {
49-
annualInterestRate = newInterestRate;
50-
}
51-
// END setters
47+
// setters
48+
public static void setAnnualInterestRate (double newInterestRate) {
49+
annualInterestRate = newInterestRate;
50+
}
51+
// END setters
5252

5353

54-
public double calculateMonthlyPayment (int numberOfPayments) {
55-
double monthlyInterest = annualInterestRate / 12;
56-
double monthlyPayment = this.principal * (monthlyInterest / (1 - Math.pow(1 + monthlyInterest, -numberOfPayments)));
57-
return monthlyPayment;
58-
}
54+
public double calculateMonthlyPayment (int numberOfPayments) {
55+
double monthlyInterest = annualInterestRate / 12;
56+
double monthlyPayment = this.principal * (monthlyInterest / (1 - Math.pow(1 + monthlyInterest, -numberOfPayments)));
57+
return monthlyPayment;
58+
}
5959
}
6060
```
6161

@@ -65,28 +65,28 @@ public class LoanAccount extends Object {
6565
import java.lang.Object;
6666

6767
public class LoanAccountTest extends Object {
68-
public static void main (String[] args) {
69-
LoanAccount loan1 = new LoanAccount( 5_000);
70-
LoanAccount loan2 = new LoanAccount(31_000);
71-
72-
double interestRates[] = {0.01, 0.05};
73-
LoanAccount loans[] = {loan1, loan2};
74-
75-
for (double interestRate : interestRates) {
76-
System.out.printf("%n%nMonthly payments for loan1 of $5000.00 and loan2 of $31000.00 for 3, 5, and 6 year loans at %.0f%% interest.", interestRate * 100);
77-
System.out.printf("%n%-7s\t%-7s\t%-7s\t%-7s", "Loan", "3 years", "5 years", "6 years");
78-
79-
for (LoanAccount loan : loans) {
80-
LoanAccount.setAnnualInterestRate(interestRate);
81-
System.out.printf(
82-
"%n%-7s\t%-7.2f\t%-7.2f\t%-7.2f", "Loan1",
83-
loan.calculateMonthlyPayment(36),
84-
loan.calculateMonthlyPayment(60),
85-
loan.calculateMonthlyPayment(72)
86-
);
87-
}
88-
}
68+
public static void main (String[] args) {
69+
LoanAccount loan1 = new LoanAccount( 5_000);
70+
LoanAccount loan2 = new LoanAccount(31_000);
71+
72+
double interestRates[] = {0.01, 0.05};
73+
LoanAccount loans[] = {loan1, loan2};
74+
75+
for (double interestRate : interestRates) {
76+
System.out.printf("%n%nMonthly payments for loan1 of $5000.00 and loan2 of $31000.00 for 3, 5, and 6 year loans at %.0f%% interest.", interestRate * 100);
77+
System.out.printf("%n%-7s\t%-7s\t%-7s\t%-7s", "Loan", "3 years", "5 years", "6 years");
78+
79+
for (LoanAccount loan : loans) {
80+
LoanAccount.setAnnualInterestRate(interestRate);
81+
System.out.printf(
82+
"%n%-7s\t%-7.2f\t%-7.2f\t%-7.2f", "Loan1",
83+
loan.calculateMonthlyPayment(36),
84+
loan.calculateMonthlyPayment(60),
85+
loan.calculateMonthlyPayment(72)
86+
);
87+
}
8988
}
89+
}
9090
}
9191
```
9292

0 commit comments

Comments
 (0)