Hands-on Exercise
After completing the hands-on exercises, you will be able to:
Implement Inheritance in your program.
Understanding Overriding
Understanding Dynamic Polymorphism.
Apply c#/java concept using Inheritance.
Scenario: Freedom Bank is a leading bank with more than 1lakh customers across world.
The bank has planned to develop automated system to manage transaction. Being a developer having
knowledge of OOP implement code to serve the following functionality
Problem Statement 1:
Create a class BankAccount to store following information which will act as base class.
Variable Data Type Data Types
owner Account Owner Name String
Balance Balance in account double
Methods
Name Purpose Arguments Return type
deposit Increase balance by amount amount(Double) Void
specified
withdrawal Withdrawal limit must be amount(Double) Void
less than 25000
Parameterized constructor Object Instantiation No of member variable NA
Problem Statement 2:
Create a class CheckingAccount to store following information which will act as child class of BankAccount.
Variable Data Type Data Types
owner Account Owner Name String
Balance Balance in account double
insufficientFundsFee Insufficinet Funds charges Double
Methods
Name Purpose Arguments Return type
processCheck Verifies checkNumber should checkNumber(String) Check
be exact six numbers 7 then bankName(String)
processes the check
withdrawl Override the Withdrawal amount(Double) Void
limit by 1000000
Parameterized constructor Object Instantiation No of member variable NA
Problem Statement 3:
Create a class Check to store following information about checks.
Variable Data Type Data Types
checkNumber Check Number String
bankName Check issuer bank String
Methods
Name Purpose Arguments Return type
Parameterized constructor Object Instantiation No of member variable NA
Problem Statement 4:
Create a class SavingsAccount to store following information which will act as child class of BankAccount.
Variable Data Type Data Types
owner Account Owner Name String
Balance Balance in account double
annualInterestRate Annual Interest rate of bank double
Methods
Name Purpose Arguments Return type
depositMonthyInterest Return the monthly interest NA Check
amount balance using annual
interest rate
withdrawl Override the Withdrawal amount(Double) Void
limit by 500000
Parameterized constructor Object Instantiation No of member variable NA
Output [Java & C#]