0% found this document useful (0 votes)
47 views

Session 08 Activity Inheritance

This document describes a hands-on exercise to implement inheritance in Java or C# to model bank accounts. It defines 4 problem statements: 1. Create a BankAccount base class to store account owner name, balance, with deposit and withdrawal methods. 2. Create a CheckingAccount child class that inherits from BankAccount and adds insufficient funds fee, overrides withdrawal limit, and has a process check method. 3. Create a Check class to store check number and issuing bank. 4. Create a SavingsAccount child class that inherits from BankAccount and adds annual interest rate, overrides withdrawal limit, and has a monthly interest deposit method.

Uploaded by

Adarsh Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Session 08 Activity Inheritance

This document describes a hands-on exercise to implement inheritance in Java or C# to model bank accounts. It defines 4 problem statements: 1. Create a BankAccount base class to store account owner name, balance, with deposit and withdrawal methods. 2. Create a CheckingAccount child class that inherits from BankAccount and adds insufficient funds fee, overrides withdrawal limit, and has a process check method. 3. Create a Check class to store check number and issuing bank. 4. Create a SavingsAccount child class that inherits from BankAccount and adds annual interest rate, overrides withdrawal limit, and has a monthly interest deposit method.

Uploaded by

Adarsh Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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#]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy