forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestLoanClass.java
More file actions
executable file
·40 lines (38 loc) · 1.34 KB
/
TestLoanClass.java
File metadata and controls
executable file
·40 lines (38 loc) · 1.34 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
/* */ package ch10;
/* */
/* */ import java.util.Scanner;
/* */
/* */
/* */ public class TestLoanClass
/* */ {
/* */ public static void main(String[] args) {
/* 9 */ Scanner input = new Scanner(System.in);
/* */
/* */
/* 12 */ System.out.print("Enter yearly interest rate, for example, 8.25: ");
/* */
/* 14 */ double annualInterestRate = input.nextDouble();
/* */
/* */
/* 17 */ System.out.print("Enter number of years as an integer: ");
/* 18 */ int numberOfYears = input.nextInt();
/* */
/* */
/* 21 */ System.out.print("Enter loan amount, for example, 120000.95: ");
/* 22 */ double loanAmount = input.nextDouble();
/* */
/* */
/* 25 */ Loan loan = new Loan(annualInterestRate, numberOfYears, loanAmount);
/* */
/* */
/* */
/* 29 */ System.out.printf("The loan was created on %s\nThe monthly payment is %.2f\nThe total payment is %.2f\n", new Object[] { loan
/* */
/* 31 */ .getLoanDate().toString(), Double.valueOf(loan.getMonthlyPayment()),
/* 32 */ Double.valueOf(loan.getTotalPayment()) });
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch10/TestLoanClass.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/