Create an inheritance hierarchy containing base class Account and derived classes SavingsAccount and CheckingAccount that inherit from class Account. Make sure all fields, methods, and parameters are declared abstract, final, public, private, protected where appropriate.
Base class Account should include one data member of type double to represent the account balance. The class should provide aa constructor that receives an initial balance and uses it to initialize the data member. The constructor should validate the initial balance to ensure that it is greater than or equal to 0.0. If not, the balance should be set to 0.0 and the constructor should display an error message, indicating that the initial balance was invalid.
The class should provide several methods. Method credit should add an amount to the current balance. Method debit should withdraw money from the account and ensure that the debit amount does not exceed the account's balance. If it does, the balance should be left unchanged and the function should print an error message. Method getBalance should return the current balance.
Derived class SavingsAccount should inherit the funcionality of an Account, but also inclute a data member of type double indicating the yearly interest rate (percentage) assigned to the account. SavingsAccount's constructor should receive the initial balance, as well as an initial value for the SavingsAccount's interest rate. SavingsAccount should provide a method applyInterest that applies the interest rate of the account to its balance, increasing the balance.
Derived class CheckingAccount should inherit from base class Account and include an additional data member of type double that represents the fee charged per transaction. Its constructor should receive the initial balance, as well as a parameter indicating the fee. The credit and debit methods should be redefined to subtract the fee from the account balance whenever either transaction is performed successfully. Note that you must not duplicate code.
Remember to test your code extensively before submitting. Submit the three .java files containing the above classes