Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program to meet the following requirements: BankAccount - TOTAL_ACCOUNT_NUMBER : int // default: 0 -accountId: int -firstName: String -lastName: String -custEmail: String

Write a Java program to meet the following requirements:

BankAccount - TOTAL_ACCOUNT_NUMBER : int // default: 0 -accountId: int -firstName: String -lastName: String -custEmail: String -balance: double -dateCreated: Date BankAccount(String firstName, String lastName, String email, double balance) +deposit(double amount) : void +withdraw(double amount) : void +toString(): String

CheckingAccount -hasDirectDeposit: Boolean -minBal: double CheckingAccount(String firstName, String lastName, String email, double balance, boolean hasDirectDeposit, double minBal) +getDirectDeposit() : boolean +setDirectDeposit(boolean flag) : void +getMinBal() : double +setMinBal(double bal) : void +toString(): String

SavingsAccount -interestRate: double SavingsAccount(String firstName, String lastName, String email, double balance, double intRate) +getInterestRate() : double +setInterestRate(double intRate) : void +toString(): String

1. Based on the UML above, define BankAccount class, CheckingAccount and SavingsAccount 2. Constructor in each class is defined as below: (1) BankAccount: (i) increase TOTAL_ACCOUNT_NUMBER (ii) assign TOTAL_ACCOUNT_NUMBER to accountId (iii) assign each parameters to data fields ( firstName, lastName....) (iv) call Date() method and assign to dateCreated ( dateCreated = new java.util.Date(); )

(2) CheckingAccount: (i) call super classs constructor (ii) assign each parameters to data fields (3) SavingsAccount : (i) call super classs constructor (ii) assign each parameters to data fields

3. deposit() and withdraw() methods: deposit => balance = balance amount withdraw => balance = balance + amount

4. Write accessor methods and mutator methods for CheckingAccount and SavingAccount as described in the above UML 5. toString() method in each class is defined as below: (1) BankAccount: returns a string including accountId, firstName,lastName,custEmail, balance and dateCreated. (2) CheckingAccount: returns a string including BankAccounts toString() method plus hasDirectDeposit and minimum balance. (3) SavingsAccount : returns a string including BankAccounts toString() method plus interestRate. 6. Write a test class(xxxx_Program4) to include a main() method that does the following steps in order. [1] Declare a Bank Object array to store two CheckingAccount objects and one SavingAccount object: ( Hard code the information in java source code which means no input from keyboard. ) [2] Call deposit and withdraw methods for every account. The first account deposits 100. The 2nd account withdraws 50. The 3rd account deposit 500 and withdraw 200. [3] Print all accounts information from the Bank Object array.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

What advice would you provide to Jennifer?

Answered: 1 week ago