Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package BankAccount;
- public class BankAccount {
- private static int currentId = 1;
- private static double interestRate = 0.02;
- private int id;
- private double balance;
- public BankAccount() {
- this.balance = balance;
- this.id = currentId++;
- }
- public static void setInterestRate(double interest) {
- interestRate = interest;
- }
- public double getInterest(int years) {
- return (this.balance * interestRate) * years;
- }
- public void deposit(double amount) {
- this.balance += amount;
- }
- public int getId() {
- return this.id;
- }
- }
RAW Paste Data