A constructor with 3 parameters id name balance - assign


(Objects and classes) Write a Java program for ATM machines to meet the following requirements:

1. Define an Account class with the following 4 private data fields:

• An int data field named id for the Account user account id (default 0).

• A String data field named name for the Account user name (default "NA").

• A double data field named balance for the Account (default 0).

• A Date data field named dateCreated that stores the date when the Account was created.

2. Implement the following methods for the Account class:

• A constructor with 3 parameters ( id, name, balance ) - assign the parameter values to these 3 data fields and initialize dateCreate= new Date();

• The accessor and mutator methods for balance.

• The accessor method for id, name, dateCreated.

• A method named withdraw that withdraws a specified amount from the Account.

• A method named deposit that deposits a specified amount to the Account.

• A method named printReceipt() that will print the 1) AccountID, 2)Account name, 3) the date

Account was created, and 4) current balance.

3. Write a test program that

• Creates three Account users with initial values as below:

id: assign 1 to the first user, assign 2 to the 2nd user, assign 3 to the 3rd user.

name: you need to assign different name for each user

balance: every user has the same initial amount 2000.

• Call deposit and withdraw methods for every user. The first user deposits 500. The 2nd user withdraws

600. The 3rd user deposit 200 and withdraw 400.

• Call the printReceipt() to display the account information for each user.

• Find the person who has the highest balance after all transactions and show the account name and

balance.

• This project should be coded in ONE java file.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: A constructor with 3 parameters id name balance - assign
Reference No:- TGS02878096

Expected delivery within 24 Hours