I'm having problems understanding and starting a Java assignment I have to complete.
We need to Develop and implement a class Account that represents a savings account (no interest stuff, thank god). It has 3 attributes: the name of the account, the owner of the account, and the current balance.
It needs to have the following constructors behaviors:
Name(): to configure a new account w/ name "name", owner "owner", and balance 0.
Name(String s, Stirng t, double n): to configure a new account with name s, owner t, and balance n
void deposit (double n): adds amount to n to the current balance of the associated account
void withdraw (double n) ....... same thing, but subtracts
void close(): zeroes out the account balance, sets the owner to "".
String getAccountName(): returns the name of the associated account.
String getOwner(): returns the owner
double getBalance(): returns the balance
void setName(String s): sets the name to s
void setOwner(String s): sets the owner to s
String toString(): to return a textual representation of the attributes of the account.
I'm way confused. I thought constructors could only be the same as their class name. Is it saying that Name() is a constructor? I don't think we need to be using default constructors for this, but I'm not sure. I've been messing around with coding it for a while, and I just don't know what the heck I'm doing.
( Horrible code that doesn't compileCollapse )What am I doing wrong?