Challenge 3: Implement an Account Class using Polymorphism
Explore how to apply polymorphism in Java by implementing an Account class with Savings and Current subclasses. This lesson helps you understand overriding methods to handle different account behaviors, enhancing your ability to write flexible and maintainable object-oriented code.
We'll cover the following...
We'll cover the following...
Problem Statement
Write a code that has:
-
A parent class named
Account.- Inside it define:
- a protected double member
balance public void Withdraw(double amount)public void Deposit(double amount)public void printBalance()
- a protected double member
- Inside it define:
-
Then, there are two derived classes
Savingsclass- has a private member
interestRateset to
- has a private member