I am not very good at programming so I will appologize ahead of time. Thank You.
public class AccountTest {
public static void main(String[] args) {
account myAccount = new account();
myAccount.setId(1122);
myAccount.setBalance(20000, 2500, 3000);
myAccount.setAnnualInterestRate(.045);
System.out.println(myAccount.toString());
}
}
public class account {
private int id;
private double balance;
private double annualInterestRate;
private double withdraw;
private double deposit;
private double monthlyInterestRate;
public account() {
id = 0;
balance = 0;
annualInterestRate = 0;
}
public void setId(int i) {
id = i;
}
public int getId() {
return id;
}
public void setBalance(double bal, double wd, double dep) {
balance = bal;
withdraw = wd;
deposit = dep;
}
public double getBalance() {
return balance - withdraw + deposit;
}
public void setAnnualInterestRate(double air) {
annualInterestRate = air;
}
public double getAnnualInterestRate() {
return annualInterestRate;
}
public String toString() {
String printAccount = "";
printAccount += "For account: " + id + "\nBalance: " +
balance + "\nMonthly Interest Rate: " +
monthlyInterestRate;
return printAccount;
}
}

New Topic/Question
Reply




MultiQuote




|