-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSavings.java
78 lines (63 loc) · 1.34 KB
/
Savings.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
68
69
70
71
72
73
74
75
76
77
//Savings Class
import java.util.*;
import java.io.*;
public class Savings extends Checkings implements Serializable
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
Savings savingsAccount = new Savings();
System.out.println("This is your balance: $"+savingsAccount.checkBalance());
System.out.println("Please enter a deposit: \n$");
double principle = input.nextDouble();
savingsAccount.makeDeposit(principle);
}
private double principle;
private double interestRate = 1.01;
private double period = 1;
//private double interest;
/*double getInterest()
{
return interest;
}*/
double calculateInterest(double balance)
{
principle = balance;
double interestC = principle*(1+interestRate*period);
principle = interestC;
return principle;
}
/*void setInterest(double interest)
{
this.interest = interest;
}*/
void setInterestRate(double interestRate)
{
this.interestRate = interestRate;
}
double getInterestRate(double interestRate)
{
return interestRate;
}
void setPeriod(int period)
{
this.period = period;
}
double getPeriod()
{
return period;
}
/* void setPrinciple(double principle)
{
this.principle+=principle;
}
double getPrinciple()
{
return principle;
}
*/
/*void applyInterest()
{
interest = principle*(1+interestRate*period);
}*/
}//end class