class BankAccount {
private String firstname;
private String lastname;
private int ssn;
private int accountnumber = 0;
private double accountbala
Forst Error is that the return type of your meyhod is void
and the method returns an int
.
public void setAccountNumber(int accountnumber) {
return accountnumber;
}
Change it to :
public int setAccountNumber(int accountnumber) {
return accountnumber;
}
and the second thing is this is not a good name for a method which is used for getting the variable , change the name of method to :
public int getAccountNumber(int accountnumber) { // why is this argument???
return accountnumber;
}
One more thing, your method
public void deposit(double amount) {
return this.accountbalance = this.accountbalance + amount;
}
has the same error. It should be :
public double deposit(double amount) { //change void to double
return this.accountbalance + amount; //as suggested by SURESH ATTA
}