SlideShare une entreprise Scribd logo
1  sur  8
Télécharger pour lire hors ligne
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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Dernier

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
 
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
 
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
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
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
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
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
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
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
 
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
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 

Dernier (20)

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
 
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
 
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
 
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
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
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
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
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
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
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
 
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...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 

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