SlideShare a Scribd company logo
1 of 3
Download to read offline
Part 1: Implement a superclass Employee that has the following fields and methods. Fields:
String firstName String lastName int employeeID double salary Methods: Constructor():
initialize balance field to null and zero. Setters and getters for firstName, lastName, and
employeeID EmployeeSummary() – prints all account attributes Part 2: Implement a Manager
class that inherits from the Employee class. Has a department attribute Methods:
EmployeeSummary() – prints all superclass and subclass attributes Ensure that your program has
the two required classes and a test class. Submit screenshots of your program’s execution and
output. Include all appropriate source code in a zip file.
Solution
import java.util.*;
import java.lang.*;
import java.io.*;
class Employee
{
//attributes of Employee class
private String firstName;
private String lastName;
private int employeeID;
private double salary;
public Employee() //default constructor
{
firstName=null;
lastName=null;
employeeID=0;
salary=0.0;
}
public void setFirstName(String fname) //set and get methods for all attributes
{
firstName = fname;
}
public String getFirstname()
{
return firstName;
}
public void setLastName(String lname)
{
lastName = lname;
}
public String getLastName()
{
return lastName;
}
public void setEmployeeID(int empId)
{
employeeID = empId;
}
public double getEmployeeID()
{
return employeeID;
}
public void setSalary(double s)
{
salary=s;
}
public double getSalary()
{
return salary;
}
public void EmployeeSummary() //display all attributes of Employee class
{
System.out.println("Employee Name: "+ firstName +" " +lastName+" Employee Id :
"+employeeID + " salary: "+salary);
}
}
class Manager extends Employee
{
private String department;
public Manager() //default constructor
{
super(); //calling superor base class default constructor
department = null;
}
public void setDepartment(String dept) //set and get methods for department
{
department=dept;
}
public String getDepartment()
{
return department;
}
public void EmployeeSummary()
{
super.EmployeeSummary(); //calling super class method with same name
System.out.println("Department : "+department);
}
}
class TestEmployee
{
public static void main (String[] args)
{
Manager mgr=new Manager();
mgr.setFirstName("Charles"); //all set methods of super class are available to derived
class
mgr.setLastName("Dickens");
mgr.setEmployeeID(34599);
mgr.setSalary(6500);
mgr.setDepartment("Accounts");
mgr.EmployeeSummary();
}
}
Output:
Success time: 0.04 memory: 711168 signal:0

More Related Content

Similar to Part 1 Implement a superclass Employee that has the following field.pdf

Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classsdjdskjd9097
 
Procedure to create_the_calculator_application java
Procedure to create_the_calculator_application javaProcedure to create_the_calculator_application java
Procedure to create_the_calculator_application javagthe
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classsdjdskjd9097
 
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxPT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxamrit47
 
Project3build.xml Builds, tests, and runs the project .docx
Project3build.xml      Builds, tests, and runs the project .docxProject3build.xml      Builds, tests, and runs the project .docx
Project3build.xml Builds, tests, and runs the project .docxwoodruffeloisa
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptxarjun431527
 
Java Practical File Diploma
Java Practical File DiplomaJava Practical File Diploma
Java Practical File Diplomamustkeem khan
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classccis224477
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classcis247
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxlorindajamieson
 
Python testing using mock and pytest
Python testing using mock and pytestPython testing using mock and pytest
Python testing using mock and pytestSuraj Deshmukh
 
OBJECT ORIENTED PROGRAMING IN C++
OBJECT ORIENTED PROGRAMING IN C++ OBJECT ORIENTED PROGRAMING IN C++
OBJECT ORIENTED PROGRAMING IN C++ Dev Chauhan
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1rupeshkanu
 

Similar to Part 1 Implement a superclass Employee that has the following field.pdf (20)

Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee class
 
Procedure to create_the_calculator_application java
Procedure to create_the_calculator_application javaProcedure to create_the_calculator_application java
Procedure to create_the_calculator_application java
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee class
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxPT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
 
Project3build.xml Builds, tests, and runs the project .docx
Project3build.xml      Builds, tests, and runs the project .docxProject3build.xml      Builds, tests, and runs the project .docx
Project3build.xml Builds, tests, and runs the project .docx
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
 
Java Practical File Diploma
Java Practical File DiplomaJava Practical File Diploma
Java Practical File Diploma
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee class
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee class
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
 
Opps manual final copy
Opps manual final   copyOpps manual final   copy
Opps manual final copy
 
OOPs manual final copy
OOPs manual final   copyOOPs manual final   copy
OOPs manual final copy
 
Python testing using mock and pytest
Python testing using mock and pytestPython testing using mock and pytest
Python testing using mock and pytest
 
Chap08
Chap08Chap08
Chap08
 
OBJECT ORIENTED PROGRAMING IN C++
OBJECT ORIENTED PROGRAMING IN C++ OBJECT ORIENTED PROGRAMING IN C++
OBJECT ORIENTED PROGRAMING IN C++
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
C#2
C#2C#2
C#2
 
Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
 

More from mampbellzumberge517

Which statements are the possible null hypothesis of an ANOVA te.pdf
Which statements are the possible null hypothesis of an ANOVA te.pdfWhich statements are the possible null hypothesis of an ANOVA te.pdf
Which statements are the possible null hypothesis of an ANOVA te.pdfmampbellzumberge517
 
What is the zone of proximal development What does this concept say.pdf
What is the zone of proximal development What does this concept say.pdfWhat is the zone of proximal development What does this concept say.pdf
What is the zone of proximal development What does this concept say.pdfmampbellzumberge517
 
Which is not one of the four basic types of tissue connective dige.pdf
Which is not one of the four basic types of tissue  connective  dige.pdfWhich is not one of the four basic types of tissue  connective  dige.pdf
Which is not one of the four basic types of tissue connective dige.pdfmampbellzumberge517
 
What are some examples of type IV hypersensitivities seen in humans .pdf
What are some examples of type IV hypersensitivities seen in humans .pdfWhat are some examples of type IV hypersensitivities seen in humans .pdf
What are some examples of type IV hypersensitivities seen in humans .pdfmampbellzumberge517
 
To what group in the periodic table would an element with atomic numb.pdf
To what group in the periodic table would an element with atomic numb.pdfTo what group in the periodic table would an element with atomic numb.pdf
To what group in the periodic table would an element with atomic numb.pdfmampbellzumberge517
 
The table below contains some data for two countries, Italy and the U.pdf
The table below contains some data for two countries, Italy and the U.pdfThe table below contains some data for two countries, Italy and the U.pdf
The table below contains some data for two countries, Italy and the U.pdfmampbellzumberge517
 
Review Southwest Airline’s plan for customer service in Figure 8.4. .pdf
Review Southwest Airline’s plan for customer service in Figure 8.4. .pdfReview Southwest Airline’s plan for customer service in Figure 8.4. .pdf
Review Southwest Airline’s plan for customer service in Figure 8.4. .pdfmampbellzumberge517
 
I am having trouble with parsing chars into seperate tokens. My code.pdf
I am having trouble with parsing chars into seperate tokens. My code.pdfI am having trouble with parsing chars into seperate tokens. My code.pdf
I am having trouble with parsing chars into seperate tokens. My code.pdfmampbellzumberge517
 
identify the dimensioning errors for the following objects. i.pdf
identify the dimensioning errors for the following objects. i.pdfidentify the dimensioning errors for the following objects. i.pdf
identify the dimensioning errors for the following objects. i.pdfmampbellzumberge517
 
Question 1 Why was it important to start with true-breeding plants.pdf
Question 1 Why was it important to start with true-breeding plants.pdfQuestion 1 Why was it important to start with true-breeding plants.pdf
Question 1 Why was it important to start with true-breeding plants.pdfmampbellzumberge517
 
Presentation Layer is concerned with which of the following a. How b.pdf
Presentation Layer is concerned with which of the following  a. How b.pdfPresentation Layer is concerned with which of the following  a. How b.pdf
Presentation Layer is concerned with which of the following a. How b.pdfmampbellzumberge517
 
Please provide a summary of the current economic crises existing in .pdf
Please provide a summary of the current economic crises existing in .pdfPlease provide a summary of the current economic crises existing in .pdf
Please provide a summary of the current economic crises existing in .pdfmampbellzumberge517
 
List the two types of sources of funds; list first the type having t.pdf
List the two types of sources of funds; list first the type having t.pdfList the two types of sources of funds; list first the type having t.pdf
List the two types of sources of funds; list first the type having t.pdfmampbellzumberge517
 
Lewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdf
Lewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdfLewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdf
Lewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdfmampbellzumberge517
 
John and his friend Robert are going to start college next year and a.pdf
John and his friend Robert are going to start college next year and a.pdfJohn and his friend Robert are going to start college next year and a.pdf
John and his friend Robert are going to start college next year and a.pdfmampbellzumberge517
 
Kingdom fungi Rhizopus produces 1n spores in two different ways fro.pdf
Kingdom fungi Rhizopus produces 1n spores in two different ways fro.pdfKingdom fungi Rhizopus produces 1n spores in two different ways fro.pdf
Kingdom fungi Rhizopus produces 1n spores in two different ways fro.pdfmampbellzumberge517
 
In what ways arc planarians more advanced than a jellyfish How are t.pdf
In what ways arc planarians more advanced than a jellyfish How are t.pdfIn what ways arc planarians more advanced than a jellyfish How are t.pdf
In what ways arc planarians more advanced than a jellyfish How are t.pdfmampbellzumberge517
 
In general, explain the connection between a Happiness or Utility fu.pdf
In general, explain the connection between a Happiness or Utility fu.pdfIn general, explain the connection between a Happiness or Utility fu.pdf
In general, explain the connection between a Happiness or Utility fu.pdfmampbellzumberge517
 
Imagine life on Earth without fungi. How would it be different Your.pdf
Imagine life on Earth without fungi. How would it be different Your.pdfImagine life on Earth without fungi. How would it be different Your.pdf
Imagine life on Earth without fungi. How would it be different Your.pdfmampbellzumberge517
 
EthicsYou are a city prosecutor, and a terrible crime has been co.pdf
EthicsYou are a city prosecutor, and a terrible crime has been co.pdfEthicsYou are a city prosecutor, and a terrible crime has been co.pdf
EthicsYou are a city prosecutor, and a terrible crime has been co.pdfmampbellzumberge517
 

More from mampbellzumberge517 (20)

Which statements are the possible null hypothesis of an ANOVA te.pdf
Which statements are the possible null hypothesis of an ANOVA te.pdfWhich statements are the possible null hypothesis of an ANOVA te.pdf
Which statements are the possible null hypothesis of an ANOVA te.pdf
 
What is the zone of proximal development What does this concept say.pdf
What is the zone of proximal development What does this concept say.pdfWhat is the zone of proximal development What does this concept say.pdf
What is the zone of proximal development What does this concept say.pdf
 
Which is not one of the four basic types of tissue connective dige.pdf
Which is not one of the four basic types of tissue  connective  dige.pdfWhich is not one of the four basic types of tissue  connective  dige.pdf
Which is not one of the four basic types of tissue connective dige.pdf
 
What are some examples of type IV hypersensitivities seen in humans .pdf
What are some examples of type IV hypersensitivities seen in humans .pdfWhat are some examples of type IV hypersensitivities seen in humans .pdf
What are some examples of type IV hypersensitivities seen in humans .pdf
 
To what group in the periodic table would an element with atomic numb.pdf
To what group in the periodic table would an element with atomic numb.pdfTo what group in the periodic table would an element with atomic numb.pdf
To what group in the periodic table would an element with atomic numb.pdf
 
The table below contains some data for two countries, Italy and the U.pdf
The table below contains some data for two countries, Italy and the U.pdfThe table below contains some data for two countries, Italy and the U.pdf
The table below contains some data for two countries, Italy and the U.pdf
 
Review Southwest Airline’s plan for customer service in Figure 8.4. .pdf
Review Southwest Airline’s plan for customer service in Figure 8.4. .pdfReview Southwest Airline’s plan for customer service in Figure 8.4. .pdf
Review Southwest Airline’s plan for customer service in Figure 8.4. .pdf
 
I am having trouble with parsing chars into seperate tokens. My code.pdf
I am having trouble with parsing chars into seperate tokens. My code.pdfI am having trouble with parsing chars into seperate tokens. My code.pdf
I am having trouble with parsing chars into seperate tokens. My code.pdf
 
identify the dimensioning errors for the following objects. i.pdf
identify the dimensioning errors for the following objects. i.pdfidentify the dimensioning errors for the following objects. i.pdf
identify the dimensioning errors for the following objects. i.pdf
 
Question 1 Why was it important to start with true-breeding plants.pdf
Question 1 Why was it important to start with true-breeding plants.pdfQuestion 1 Why was it important to start with true-breeding plants.pdf
Question 1 Why was it important to start with true-breeding plants.pdf
 
Presentation Layer is concerned with which of the following a. How b.pdf
Presentation Layer is concerned with which of the following  a. How b.pdfPresentation Layer is concerned with which of the following  a. How b.pdf
Presentation Layer is concerned with which of the following a. How b.pdf
 
Please provide a summary of the current economic crises existing in .pdf
Please provide a summary of the current economic crises existing in .pdfPlease provide a summary of the current economic crises existing in .pdf
Please provide a summary of the current economic crises existing in .pdf
 
List the two types of sources of funds; list first the type having t.pdf
List the two types of sources of funds; list first the type having t.pdfList the two types of sources of funds; list first the type having t.pdf
List the two types of sources of funds; list first the type having t.pdf
 
Lewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdf
Lewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdfLewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdf
Lewis Carroll (actual name Charles Dodgson, 1832 - 1898) was one far.pdf
 
John and his friend Robert are going to start college next year and a.pdf
John and his friend Robert are going to start college next year and a.pdfJohn and his friend Robert are going to start college next year and a.pdf
John and his friend Robert are going to start college next year and a.pdf
 
Kingdom fungi Rhizopus produces 1n spores in two different ways fro.pdf
Kingdom fungi Rhizopus produces 1n spores in two different ways fro.pdfKingdom fungi Rhizopus produces 1n spores in two different ways fro.pdf
Kingdom fungi Rhizopus produces 1n spores in two different ways fro.pdf
 
In what ways arc planarians more advanced than a jellyfish How are t.pdf
In what ways arc planarians more advanced than a jellyfish How are t.pdfIn what ways arc planarians more advanced than a jellyfish How are t.pdf
In what ways arc planarians more advanced than a jellyfish How are t.pdf
 
In general, explain the connection between a Happiness or Utility fu.pdf
In general, explain the connection between a Happiness or Utility fu.pdfIn general, explain the connection between a Happiness or Utility fu.pdf
In general, explain the connection between a Happiness or Utility fu.pdf
 
Imagine life on Earth without fungi. How would it be different Your.pdf
Imagine life on Earth without fungi. How would it be different Your.pdfImagine life on Earth without fungi. How would it be different Your.pdf
Imagine life on Earth without fungi. How would it be different Your.pdf
 
EthicsYou are a city prosecutor, and a terrible crime has been co.pdf
EthicsYou are a city prosecutor, and a terrible crime has been co.pdfEthicsYou are a city prosecutor, and a terrible crime has been co.pdf
EthicsYou are a city prosecutor, and a terrible crime has been co.pdf
 

Recently uploaded

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 

Recently uploaded (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 

Part 1 Implement a superclass Employee that has the following field.pdf

  • 1. Part 1: Implement a superclass Employee that has the following fields and methods. Fields: String firstName String lastName int employeeID double salary Methods: Constructor(): initialize balance field to null and zero. Setters and getters for firstName, lastName, and employeeID EmployeeSummary() – prints all account attributes Part 2: Implement a Manager class that inherits from the Employee class. Has a department attribute Methods: EmployeeSummary() – prints all superclass and subclass attributes Ensure that your program has the two required classes and a test class. Submit screenshots of your program’s execution and output. Include all appropriate source code in a zip file. Solution import java.util.*; import java.lang.*; import java.io.*; class Employee { //attributes of Employee class private String firstName; private String lastName; private int employeeID; private double salary; public Employee() //default constructor { firstName=null; lastName=null; employeeID=0; salary=0.0; } public void setFirstName(String fname) //set and get methods for all attributes { firstName = fname; } public String getFirstname() {
  • 2. return firstName; } public void setLastName(String lname) { lastName = lname; } public String getLastName() { return lastName; } public void setEmployeeID(int empId) { employeeID = empId; } public double getEmployeeID() { return employeeID; } public void setSalary(double s) { salary=s; } public double getSalary() { return salary; } public void EmployeeSummary() //display all attributes of Employee class { System.out.println("Employee Name: "+ firstName +" " +lastName+" Employee Id : "+employeeID + " salary: "+salary); } } class Manager extends Employee { private String department;
  • 3. public Manager() //default constructor { super(); //calling superor base class default constructor department = null; } public void setDepartment(String dept) //set and get methods for department { department=dept; } public String getDepartment() { return department; } public void EmployeeSummary() { super.EmployeeSummary(); //calling super class method with same name System.out.println("Department : "+department); } } class TestEmployee { public static void main (String[] args) { Manager mgr=new Manager(); mgr.setFirstName("Charles"); //all set methods of super class are available to derived class mgr.setLastName("Dickens"); mgr.setEmployeeID(34599); mgr.setSalary(6500); mgr.setDepartment("Accounts"); mgr.EmployeeSummary(); } } Output: Success time: 0.04 memory: 711168 signal:0