-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBank.java
67 lines (57 loc) · 2.14 KB
/
Bank.java
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
import java.util.Scanner;
public class Bank
{
static double loanpercent;
static double downpayment;
static double interestcharge;
static double processingfee;
static double misccharge;
static double modt;
int months;
int years;
double interestrate;
static double emi;
static double bankamt;
double principalamt;
public void inputBank()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter Home Loan Sanction Percentage: ");
loanpercent = sc.nextDouble();
calcDownPayment();
System.out.printf("Is the Down Payment Amount (y/n): "+ downpayment);
sc=new Scanner(System.in);
String r = sc.nextLine();
if(r.equalsIgnoreCase("n"))
{
System.out.println("Enter Down Payment Amount: ");
downpayment = sc.nextDouble();
}
System.out.println("Enter MODT (Memorandum of Deposit of the Title Deed Charges): ");
modt = sc.nextDouble();
System.out.println("Enter Interest Charge (type 0 if not applicable): ");
interestcharge = sc.nextDouble();
System.out.println("Enter Loan Processing Fee: ");
processingfee = sc.nextDouble();
System.out.println("Enter Miscellaneous Charge: ");
misccharge = sc.nextDouble();
System.out.println("Do you want to calculate EMI? (y/n): ");
sc=new Scanner(System.in);
String r2 = sc.nextLine();
if(r2.equalsIgnoreCase("y"))
{
System.out.println("Enter time period (in years): ");
years = sc.nextInt();
months = years*12;
System.out.println("Enter rate of interest (in %): ");
interestrate = sc.nextInt();
emi = (principalamt*interestrate*Math.pow(1+interestrate,months))/(Math.pow(1+interestrate,months)-1);
}
bankamt = modt+interestcharge+processingfee+misccharge;
}
public void calcDownPayment()
{
downpayment = loanpercent*Build.bsp/100;
principalamt = Build.bsp - downpayment;
}
}