SlideShare a Scribd company logo
1 of 8
Download to read offline
Object Oriented Programming
Lab
CS123
Noushin Saba
Asfand Yar
Lab # 6
Inheritance
Inheritance
• One class acquires the properties and behavior of another class
• Represents a parent-child relationship between two classes
• Subclass
• A subclass, also known as a child class or derived class, is the class that inherits the properties
and behaviors of another class
• Superclass
• A superclass, also known as a parent class or base class, is a class whose properties and
behaviors are inherited by the subclass
• Implemented using the extends keyword
Account Class
• Superclass
• Attributes
• accountNumber, balance, and withdrawal limits
• Constructor
• No argument constructor
• Parameterized constructor
• Methods
• Set and get methods
• Depositing amount
• Withdrawing amount
• Calculating interest
• Displaying account information
CheckingAccount Class
• Subclass inherited from Account
• Attributes
• Overdraft Limit
• Constructor
• No argument constructor
• Parameterized constructor
• Methods
• Get and set methods
• Overrides withdraw method to handle overdrafts
• Overrides display information
Tasks
Task 1: Saving Account inherited from Account class
• Create a SavingAccount subclass with the following:
• Attributes
• Interest rate
• Constructor
• No argument constructor
• Parameterized constructor
• Methods
• Get and set methods
• Override calculate interest method
• Override display information
• Write main to check the functionality of SavingAccount
Tasks
• Task 2: Employee, Manager, Team Lead
Employee: This is the base class representing generic employees in the company. It
might contain attributes like name, employee ID, and methods for calculating salary
or displaying employee information.
Manager: The Manager class inherits from Employee and adds specific attributes
and behaviors relevant to managers, such as managing a team, approving leave
requests, or conducting performance reviews.
TeamLead: The TeamLead class further specializes in Managers. It inherits all the
attributes and behaviors of a Manager but may add additional features specific to
team leaders, like assigning tasks, mentoring team members, or coordinating team
meetings.
Tasks
• Employee class
• Attributes
• Name (first, last)
• Employee ID
• Employment status – Active
• Hire date
• Email address
• Phone number
• Department
• Position
• Salary
• Methods
• Get and Set Method
• Promote (change position)
• Terminate (change employment
status)
• Manager class
• Attributes
• Direct Reports (List of
Employees)
• Project (List)
• Methods
• Add direct reports
• Assign Projects
• Evaluate Performance
• TeamLead class
• Attributes
• Team name
• Team Tasks (List)
• Methods
• Hold team meeting
• Add and display team
tasks

More Related Content

Similar to Java inheritance Presentation with Examples

Query Handling System
Query Handling SystemQuery Handling System
Query Handling Systemhimabindu54
 
TeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptx
TeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptxTeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptx
TeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptxJasper Oosterveld
 
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...Toni Frankola
 
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...spsnyc
 
ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?
ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?
ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?European Collaboration Summit
 
Performance Management - Herman Augnis
Performance Management - Herman Augnis Performance Management - Herman Augnis
Performance Management - Herman Augnis Preeti Bhaskar
 
Discovering the New SuccessFactors LMS Admin Features
Discovering the New SuccessFactors LMS Admin FeaturesDiscovering the New SuccessFactors LMS Admin Features
Discovering the New SuccessFactors LMS Admin FeaturesAshton Plusquellec
 
HR Analytics (2).pptx
HR Analytics (2).pptxHR Analytics (2).pptx
HR Analytics (2).pptxNipunHarsha1
 
Oracle Human Capital Management
Oracle Human Capital ManagementOracle Human Capital Management
Oracle Human Capital ManagementAddvantum
 
Agile organization design workshop
Agile organization design workshopAgile organization design workshop
Agile organization design workshopAHAConference
 
From 0 to 100 coaching 100+ teams in an agile transformation by Tolga Kombak...
From 0 to 100  coaching 100+ teams in an agile transformation by Tolga Kombak...From 0 to 100  coaching 100+ teams in an agile transformation by Tolga Kombak...
From 0 to 100 coaching 100+ teams in an agile transformation by Tolga Kombak...Agile ME
 
Job Evaluation Program
Job Evaluation ProgramJob Evaluation Program
Job Evaluation ProgramSeta Wicaksana
 

Similar to Java inheritance Presentation with Examples (20)

DTEK Talent Management System
DTEK Talent Management SystemDTEK Talent Management System
DTEK Talent Management System
 
Query Handling System
Query Handling SystemQuery Handling System
Query Handling System
 
Quiz Interact
Quiz Interact Quiz Interact
Quiz Interact
 
TeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptx
TeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptxTeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptx
TeamsNation 2022 - Governance for Microsoft Teams - A to Z.pptx
 
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
 
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
Governance in the Modern Workplace: SharePoint, OneDrive, Groups, Teams, Flow...
 
ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?
ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?
ECS19 - Benjamin Niaulin - MOVED TO OFFICE 365, NOW WHAT?
 
Performance Management - Herman Augnis
Performance Management - Herman Augnis Performance Management - Herman Augnis
Performance Management - Herman Augnis
 
Discovering the New SuccessFactors LMS Admin Features
Discovering the New SuccessFactors LMS Admin FeaturesDiscovering the New SuccessFactors LMS Admin Features
Discovering the New SuccessFactors LMS Admin Features
 
Chapter 3- Performance Management
Chapter 3- Performance ManagementChapter 3- Performance Management
Chapter 3- Performance Management
 
Reward Management
Reward ManagementReward Management
Reward Management
 
Agile certificates, PMI -ACP and Agile practice guide
Agile certificates,  PMI -ACP and Agile practice guideAgile certificates,  PMI -ACP and Agile practice guide
Agile certificates, PMI -ACP and Agile practice guide
 
HR Analytics (2).pptx
HR Analytics (2).pptxHR Analytics (2).pptx
HR Analytics (2).pptx
 
Mini Project.pptx
Mini Project.pptxMini Project.pptx
Mini Project.pptx
 
Oracle Human Capital Management
Oracle Human Capital ManagementOracle Human Capital Management
Oracle Human Capital Management
 
Agile organization design workshop
Agile organization design workshopAgile organization design workshop
Agile organization design workshop
 
From 0 to 100 coaching 100+ teams in an agile transformation by Tolga Kombak...
From 0 to 100  coaching 100+ teams in an agile transformation by Tolga Kombak...From 0 to 100  coaching 100+ teams in an agile transformation by Tolga Kombak...
From 0 to 100 coaching 100+ teams in an agile transformation by Tolga Kombak...
 
Blooms
BloomsBlooms
Blooms
 
Resume
ResumeResume
Resume
 
Job Evaluation Program
Job Evaluation ProgramJob Evaluation Program
Job Evaluation Program
 

Recently uploaded

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 

Recently uploaded (20)

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 

Java inheritance Presentation with Examples

  • 3. Inheritance • One class acquires the properties and behavior of another class • Represents a parent-child relationship between two classes • Subclass • A subclass, also known as a child class or derived class, is the class that inherits the properties and behaviors of another class • Superclass • A superclass, also known as a parent class or base class, is a class whose properties and behaviors are inherited by the subclass • Implemented using the extends keyword
  • 4. Account Class • Superclass • Attributes • accountNumber, balance, and withdrawal limits • Constructor • No argument constructor • Parameterized constructor • Methods • Set and get methods • Depositing amount • Withdrawing amount • Calculating interest • Displaying account information
  • 5. CheckingAccount Class • Subclass inherited from Account • Attributes • Overdraft Limit • Constructor • No argument constructor • Parameterized constructor • Methods • Get and set methods • Overrides withdraw method to handle overdrafts • Overrides display information
  • 6. Tasks Task 1: Saving Account inherited from Account class • Create a SavingAccount subclass with the following: • Attributes • Interest rate • Constructor • No argument constructor • Parameterized constructor • Methods • Get and set methods • Override calculate interest method • Override display information • Write main to check the functionality of SavingAccount
  • 7. Tasks • Task 2: Employee, Manager, Team Lead Employee: This is the base class representing generic employees in the company. It might contain attributes like name, employee ID, and methods for calculating salary or displaying employee information. Manager: The Manager class inherits from Employee and adds specific attributes and behaviors relevant to managers, such as managing a team, approving leave requests, or conducting performance reviews. TeamLead: The TeamLead class further specializes in Managers. It inherits all the attributes and behaviors of a Manager but may add additional features specific to team leaders, like assigning tasks, mentoring team members, or coordinating team meetings.
  • 8. Tasks • Employee class • Attributes • Name (first, last) • Employee ID • Employment status – Active • Hire date • Email address • Phone number • Department • Position • Salary • Methods • Get and Set Method • Promote (change position) • Terminate (change employment status) • Manager class • Attributes • Direct Reports (List of Employees) • Project (List) • Methods • Add direct reports • Assign Projects • Evaluate Performance • TeamLead class • Attributes • Team name • Team Tasks (List) • Methods • Hold team meeting • Add and display team tasks