Challenge 2: Handling a Bank Account

In this challenge, you will define methods for handling a bank account using concepts of inheritance.

Problem statement

In this challenge, we will implement methods in the parent class and its corresponding child class.

The initializers for both classes have been defined for you.

Task 1

In the Account class, implement the getBalance() method that returns balance.

Task 2

In the Account class, implement the deposit(amount) method that adds amount to the balance. It does not return anything.

Sample input

balance = 2000
deposit(500)
getbalance()

Sample output

2500

Task 3

In the Account class, implement the withdrawal(amount) method that subtracts the amount from the balance. It does not return anything.

Sample input

balance = 2000
withdrawal(500)
getbalance()

Sample output

1500

Task 4

In the SavingsAccount class, implement an interestAmount() method that returns the interest amount of the current balance. Below is the formula for calculating the interest amount:

Get hands-on with 1400+ tech skills courses.