|
|
|
@ -0,0 +1,25 @@ |
|
|
|
public class Account{ |
|
|
|
int id = 0; |
|
|
|
double startBalance = 0; |
|
|
|
double endBalance = 0; |
|
|
|
double monthlyInterestRate = 0.03; |
|
|
|
double interest; |
|
|
|
public Account (){ |
|
|
|
} |
|
|
|
public Account (int id, double balance, double monthlyInterestRate){ |
|
|
|
this.id = id; |
|
|
|
this.startBalance = balance; |
|
|
|
this.monthlyInterestRate = monthlyInterestRate; |
|
|
|
} |
|
|
|
public void computeInterest(){ |
|
|
|
this.interest = this.startBalance * this.monthlyInterestRate; |
|
|
|
this.endBalance = this.startBalance+this.interest; |
|
|
|
} |
|
|
|
public void printAccountInfo(){ |
|
|
|
// this.computeInterest(); |
|
|
|
System.out.println("Account ID: " + this.id); |
|
|
|
System.out.println("Account Balance: " + this.startBalance); |
|
|
|
System.out.println("Interest gained: " + this.interest); |
|
|
|
System.out.println("New balance: " + this.endBalance); |
|
|
|
} |
|
|
|
} |