You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
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); }}
|