Develop Java classes so we can manage bank accounts and typical banking transactions. There are three types of transactions: deposit, withdrawal, balanceRequest:
-a deposit is used to increase the amount in an account
-a withdrawal is used to decrease the amount in an account a balance request causes a display on System.out
-Most transactions specify a date, a type, an amount, and an account number.
Class and its Fields
balance – integer value
lastSeq – a static field as identifier for the transaction, just like lastId in Student
sequenceNumber - to be generated using lastSeq
amount – amounts are positive integers
You need to create following Bank Accounts:
account number initial balance owner
1901 1100 Nancy
1902 1000 Alex
1903 1900 Juby
1904 900 James
1905 1200 Jason
One constructor is required for the account class: public Account (String accountNumber, int balance, String owner). Account class must have a toString method to display the accountNumber, balance, and owner.
You need to create following Transactions:
dateOf type amount account
Jan 1, 2019 deposit 1000 1901
Jan 2, 2019 deposit 1000 1902
Jan 3, 2019 deposit 3000 1904
Jan 4, 2019 deposit 4000 1903
Jan 5, 2019 withdrawal 250 1903
Jan 6, 2019 withdrawal 1500 1903
Jan 7, 2019 deposit 4 000 1905
Jan 8, 2019 balanceRequest 1901
Jan 8, 2019 balanceRequest 1903
Jan 8, 2019 balanceRequest 1905
Transaction class must have a toString method to display all fields including the sequence number.
Two constructors are required for Transaction class:
public Transaction(String dateOf, String type, Account account)
public Transaction(String dateOf, String type, int amount, Account account)
Note that sequenceNumber is assigned to a transaction in the same manner that id was assigned to a Student in the example on our textbook.
What you need to implement:
1. Create the accounts.
2. Create the transactions.
3. Display all of the accounts and transactions.
4. Apply the transactions to the accounts (in the order the transactions are listed above) and then display all of the accounts again.
5. Display any account with a balance over 2000.
Hint: You can put all of the methods for tasks 3, 4, and 5 in another class, while the main method of this class should do nothing but only call other necessary methods.
This assignment has been answered 6 times in private sessions.
© 2020 Codify Tutor. All rights reserved