Posts

Showing posts from November, 2021

Task 9B - Inheritance, Polymorphism, Overriding, Enums and more

Identify and write the code of classes, their attributes, behavior and relationships that shall fulfil below requirements. Think and decide yourself where you need to use which type, where enum make sense, where overloading, overriding and inheritance can help etc. to devise a solution that is reusable and maintainable. It has nothing to do with how real banking work, so don’t worry if something do not make sense to you. A bank allow citizens to open accounts, each account must have an id, opening balance, account holder name, and age. Bank offers 3 types of accounts i.e. current account, saving account and investment account. Bank gives no profit on current accounts but to others. So, the saving and investment account are earning accounts, means the account holders of saving and investment accounts make profit from their deposits. Both earning based account shall expose a public behavior to retrieve total earnings (how it’s calculated is explained below). All saving accounts has a cat