I'm new to JAVA and I can't seem to get this thing down I might be totally off. But I need to do a withdraw and deposit method any ideas??
public class Account {
private int id;
private double balance;
private double annualInterestRate;
private double withdraw;
private double deposit;
private double withdrawTotal;
private double depositTotal;
//----------------------------------------
// Default constructor
//----------------------------------------
Account()
{
id = 0;
balance = 0;
annualInterestRate = 0;
withdraw = 0;
deposit = 0;
}
//---------------------------------------
// Accessor method
//---------------------------------------
public int getId() {
return id;
}
public double getBalance(){
return balance;
}
public double getAnnualInterestRate(){
return annualInterestRate;
}
public double getWithdraw() {
return withdraw;
}
public double getDeposit() {
return deposit;
}
public double getWithdrawTotal() {
return withdrawTotal;
}
public double getDepositTotal() {
return depositTotal;
}
//------------------------------------------
// Mutator methods
//------------------------------------------
public void setId(int newId){
id = newId;
}
public void setBalance(double newBalance){
balance = newBalance;
}
public void setAnnualInterestRate(double newAnnualInterestRate){
annualInterestRate = newAnnualInterestRate;
}
public void setWithdraw(double newWithdraw){
withdraw = newWithdraw;
}
//-------------------------------------------
// Withdraw method
//-------------------------------------------
public double withdrawCalculuation() {
return balance - withdraw;
}
public double depositCalculation(){
return balance + deposit;
}
public double annualInterestRateCalculation(){
return depositTotal * .045;
}
//--------------------------------------------
// void method to display the account
//--------------------------------------------
public void print() {
Account account = new Account();
account.setId(1122);
account.setBalance($20000.00);
account.setWithdraw($2500);
account.setWithdrawTotal($17500.00);
account.setDeposit($3000.00);
account.setDepositTotal($20500.00);
account.setAnnualInterestRate(.045);
//------------------------------------------
// Displaying using the get methods
//------------------------------------------
System.out.println("The Accound id is:" + account.getId());
System.out.println("The Balance is:" + account.getBalance());
System.out.println("Amount of withdrawal is:" + account.getWithdraw());
System.out.println("The Balance after withdrawal is:" + account.getWithdrawTotal());
System.out.println("Amount of deposit is:" + account.getDeposit());
System.out.println("The Balance after depsoit is:" + account.getDepositTotal());
System.out.println("The monthly interest for total amount is:" + account.getAnnualInterestRate());
}
}
Account.java:94: ')' expected
account.setBalance($20000.0);
^
Account.java:94: illegal start of expression
account.setBalance($20000.0);
^