Declare a class name bankaccount the rest of the


Write Java code to implement the class BankAccount.

Declare a class name BankAccount. The rest of the instructions are for this class.

Declare three instance variables. The instance variables must be private. The first variable is of type String and named accountID.

The second variable is of type double and named balance.

The third variable is of type String and named dateOpened.

Declare a public constructor that takes in three parameters. The first parameter is of type String and is used to initialize the accountID instance variable. The second parameter is of type double and is used to initialize the balance. The third variable is of type String and is used to initialize the dateOpened instance variable.

Declare and write code for a public method named deposit that takes in a double input parameter and returns a value of type double. This method adds the amount passed in the input parameter variable to the balance and returns the updated balance.

Declare and write code for a public method named withdraw that takes in a double input parameter and returns a value of type boolean. If the amount being withdrawn is greater than the existing balance, then the method returns false. Else, it subtracts the amount being withdrawn from the balance and returns true.

Declare and write code for a public method named getDateOpened that takes in no parameters and returns a value of type String which is the date the account was opened.

Solution Preview :

Prepared by a verified Expert
Business Management: Declare a class name bankaccount the rest of the
Reference No:- TGS02560372

Now Priced at $10 (50% Discount)

Recommended (90%)

Rated (4.3/5)