SlideShare a Scribd company logo
1 of 18
Download to read offline
First compile all the classes.But to run the program we have to run the class which is having the
main method.
here TestEveryOne.java class is having the main() method.If we run the program we may get the
output.
Before Posting the code I checked for Errors twice,Only After ensuring that this programs are
having no errors and working fine am posting.If Any Problem Happened just do comment.I will
be available until you satisfied with my answer. _Thank you
To Compile .java file we have to use javac command like to compile javac TestEveryOne.java
To run the program we have to use java TestEveryOne.
_____________________________________________________________________
TestEveryOne.java
public class TestEveryOne {
public static void main(String[] args) {
//Creating the object of Employee Class
Person person=new Person("Kane","101 Church
Street","kane@gamil.com",991234568);
//Displaying the Person Details
System.out.println(person.toString());
//Creating the object of Student Class
Student s=new Student(0) ;
//Displaying the Student Details
System.out.println(s.toString());
//Creating the date Class Object
Date d=new Date(2016, 06, 31);
//Creating the object of Employee Class
Employee emp=new Employee("WIPRO", 50000, d);
//Displaying the Employee Details
System.out.println(emp.toString());
//Creating the object of Faculty Class
Faculty faculty=new Faculty(8, "Professor");
//Displaying the Faculty Details
System.out.println(faculty.toString());
Staff staff=new Staff("Engineer");
System.out.println(staff.toString());
}
}
______________________________________________________________
Person.java
public class Person {
//Declaring variables
private String name,address,email_address;
private long phone_number;
//Zero Argument Constructor
public Person() {
super();
}
//Parameterized constructor.
public Person(String name, String address, String email_address,
long phone_number) {
super();
this.name = name;
this.address = address;
this.email_address = email_address;
this.phone_number = phone_number;
}
//Setters and getters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmail_address() {
return email_address;
}
public void setEmail_address(String email_address) {
this.email_address = email_address;
}
public long getPhone_number() {
return phone_number;
}
public void setPhone_number(long phone_number) {
this.phone_number = phone_number;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Person [name=" + name + ", address=" + address + ", email_address="
+ email_address + ", phone_number=" + phone_number + "]";
}
}
__________________________________________________
Student.java
public class Student extends Person {
//Declaring variables
private String status;
//Zero Argument Constructor
public Student() {
super();
}
//Parameterized constructor.
public Student(int status) {
super();
if(status==0)
this.status="Freshman";
else if(status==1)
this.status="Sophomore";
else if(status==2)
this.status="Junior";
else if(status==3)
this.status="Senior";
}
//Setters and getters
public String getStatus() {
return status;
}
public void setStatus(int status) {
if(status==0)
this.status="Freshman";
else if(status==1)
this.status="Sophomore";
else if(status==2)
this.status="Junior";
else if(status==3)
this.status="Senior";
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Student [status=" + status + "]";
}
}
_________________________________________________
Employee.java
public class Employee extends Person {
//Declaring variables
private String office;
private double salary;
private Date date_hired;
//Zero Argument Constructor
public Employee() {
super();
}
//Parameterized constructor.
public Employee(String office, double salary, Date date_hired) {
super();
this.office = office;
this.salary = salary;
this.date_hired = date_hired;
}
//Setters and getters
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public Date getDate_hired() {
return date_hired;
}
public void setDate_hired(Date date_hired) {
this.date_hired = date_hired;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Employee [office=" + office + ", salary=" + salary
+ ", date_hired=" + date_hired + "]";
}
}
____________________________________________________________
Date.java
import java.util.Calendar;
public class Date {
//Declaring variables
private int year,month,day;
//Zero Argument Constructor
public Date() {
super();
Calendar now = Calendar.getInstance(); // Gets the current date and time
this.year=now.get(Calendar.YEAR);
this.month=now.get(Calendar.MONTH);
this.day=now.get(Calendar.DAY_OF_MONTH);
}
//Parameterized constructor.
public Date(int year, int month, int day) {
super();
this.year = year;
this.month = month;
this.day = day;
}
//Setters and getters
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return +day +"-"+month+"-"+year;
}
}
_________________________________________________________
Faculty.java
public class Faculty extends Employee {
//Declaring variables
private int office_hours;
private String rank;
//Zero Argument Constructor
public Faculty() {
super();
}
//Parameterized constructor.
public Faculty(int office_hours, String rank) {
super();
this.office_hours = office_hours;
this.rank = rank;
}
//Setters and getters
public int getOffice_hours() {
return office_hours;
}
public void setOffice_hours(int office_hours) {
this.office_hours = office_hours;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Faculty [office_hours=" + office_hours + ", rank=" + rank + "]";
}
}
___________________________________________________________
Staff.java
public class Staff extends Person {
//Declaring variables
private String title;
//Zero Argument Constructor
public Staff() {
super();
}
//Parameterized constructor.
public Staff(String title) {
super();
this.title = title;
}
//Setters and getters
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Staff [title=" + title + "]";
}
}
_____________________________________________________________
Output:
Person [name=Kane, address=101 Church Street, email_address=kane@gamil.com,
phone_number=991234568]
Student [status=Freshman]
Employee [office=WIPRO, salary=50000.0, date_hired=31-6-2016]
Faculty [office_hours=8, rank=Professor]
Staff [title=Engineer]
______________________________________________________________________
Solution
First compile all the classes.But to run the program we have to run the class which is having the
main method.
here TestEveryOne.java class is having the main() method.If we run the program we may get the
output.
Before Posting the code I checked for Errors twice,Only After ensuring that this programs are
having no errors and working fine am posting.If Any Problem Happened just do comment.I will
be available until you satisfied with my answer. _Thank you
To Compile .java file we have to use javac command like to compile javac TestEveryOne.java
To run the program we have to use java TestEveryOne.
_____________________________________________________________________
TestEveryOne.java
public class TestEveryOne {
public static void main(String[] args) {
//Creating the object of Employee Class
Person person=new Person("Kane","101 Church
Street","kane@gamil.com",991234568);
//Displaying the Person Details
System.out.println(person.toString());
//Creating the object of Student Class
Student s=new Student(0) ;
//Displaying the Student Details
System.out.println(s.toString());
//Creating the date Class Object
Date d=new Date(2016, 06, 31);
//Creating the object of Employee Class
Employee emp=new Employee("WIPRO", 50000, d);
//Displaying the Employee Details
System.out.println(emp.toString());
//Creating the object of Faculty Class
Faculty faculty=new Faculty(8, "Professor");
//Displaying the Faculty Details
System.out.println(faculty.toString());
Staff staff=new Staff("Engineer");
System.out.println(staff.toString());
}
}
______________________________________________________________
Person.java
public class Person {
//Declaring variables
private String name,address,email_address;
private long phone_number;
//Zero Argument Constructor
public Person() {
super();
}
//Parameterized constructor.
public Person(String name, String address, String email_address,
long phone_number) {
super();
this.name = name;
this.address = address;
this.email_address = email_address;
this.phone_number = phone_number;
}
//Setters and getters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmail_address() {
return email_address;
}
public void setEmail_address(String email_address) {
this.email_address = email_address;
}
public long getPhone_number() {
return phone_number;
}
public void setPhone_number(long phone_number) {
this.phone_number = phone_number;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Person [name=" + name + ", address=" + address + ", email_address="
+ email_address + ", phone_number=" + phone_number + "]";
}
}
__________________________________________________
Student.java
public class Student extends Person {
//Declaring variables
private String status;
//Zero Argument Constructor
public Student() {
super();
}
//Parameterized constructor.
public Student(int status) {
super();
if(status==0)
this.status="Freshman";
else if(status==1)
this.status="Sophomore";
else if(status==2)
this.status="Junior";
else if(status==3)
this.status="Senior";
}
//Setters and getters
public String getStatus() {
return status;
}
public void setStatus(int status) {
if(status==0)
this.status="Freshman";
else if(status==1)
this.status="Sophomore";
else if(status==2)
this.status="Junior";
else if(status==3)
this.status="Senior";
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Student [status=" + status + "]";
}
}
_________________________________________________
Employee.java
public class Employee extends Person {
//Declaring variables
private String office;
private double salary;
private Date date_hired;
//Zero Argument Constructor
public Employee() {
super();
}
//Parameterized constructor.
public Employee(String office, double salary, Date date_hired) {
super();
this.office = office;
this.salary = salary;
this.date_hired = date_hired;
}
//Setters and getters
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public Date getDate_hired() {
return date_hired;
}
public void setDate_hired(Date date_hired) {
this.date_hired = date_hired;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Employee [office=" + office + ", salary=" + salary
+ ", date_hired=" + date_hired + "]";
}
}
____________________________________________________________
Date.java
import java.util.Calendar;
public class Date {
//Declaring variables
private int year,month,day;
//Zero Argument Constructor
public Date() {
super();
Calendar now = Calendar.getInstance(); // Gets the current date and time
this.year=now.get(Calendar.YEAR);
this.month=now.get(Calendar.MONTH);
this.day=now.get(Calendar.DAY_OF_MONTH);
}
//Parameterized constructor.
public Date(int year, int month, int day) {
super();
this.year = year;
this.month = month;
this.day = day;
}
//Setters and getters
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return +day +"-"+month+"-"+year;
}
}
_________________________________________________________
Faculty.java
public class Faculty extends Employee {
//Declaring variables
private int office_hours;
private String rank;
//Zero Argument Constructor
public Faculty() {
super();
}
//Parameterized constructor.
public Faculty(int office_hours, String rank) {
super();
this.office_hours = office_hours;
this.rank = rank;
}
//Setters and getters
public int getOffice_hours() {
return office_hours;
}
public void setOffice_hours(int office_hours) {
this.office_hours = office_hours;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Faculty [office_hours=" + office_hours + ", rank=" + rank + "]";
}
}
___________________________________________________________
Staff.java
public class Staff extends Person {
//Declaring variables
private String title;
//Zero Argument Constructor
public Staff() {
super();
}
//Parameterized constructor.
public Staff(String title) {
super();
this.title = title;
}
//Setters and getters
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
//toString() method displays the contents of the object.
@Override
public String toString() {
return "Staff [title=" + title + "]";
}
}
_____________________________________________________________
Output:
Person [name=Kane, address=101 Church Street, email_address=kane@gamil.com,
phone_number=991234568]
Student [status=Freshman]
Employee [office=WIPRO, salary=50000.0, date_hired=31-6-2016]
Faculty [office_hours=8, rank=Professor]
Staff [title=Engineer]
______________________________________________________________________

More Related Content

Similar to First compile all the classes.But to run the program we have to run .pdf

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
 
CSE 110 - Lab 6 What this Lab Is About  Working wi.docx
CSE 110 - Lab 6 What this Lab Is About  Working wi.docxCSE 110 - Lab 6 What this Lab Is About  Working wi.docx
CSE 110 - Lab 6 What this Lab Is About  Working wi.docxfaithxdunce63732
 
Should be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdfShould be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdffashionscollect
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdfanithareadymade
 
Preexisting code, please useMain.javapublic class Main { p.pdf
Preexisting code, please useMain.javapublic class Main {    p.pdfPreexisting code, please useMain.javapublic class Main {    p.pdf
Preexisting code, please useMain.javapublic class Main { p.pdfrd1742
 
Introduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxIntroduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxPoonam60376
 
Assignment 7
Assignment 7Assignment 7
Assignment 7IIUM
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfirshadkumar3
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with KotlinBrandon Wever
 
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxINTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxnormanibarber20063
 
How to write clean tests
How to write clean testsHow to write clean tests
How to write clean testsDanylenko Max
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMockYing Zhang
 

Similar to First compile all the classes.But to run the program we have to run .pdf (20)

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
 
CSE 110 - Lab 6 What this Lab Is About  Working wi.docx
CSE 110 - Lab 6 What this Lab Is About  Working wi.docxCSE 110 - Lab 6 What this Lab Is About  Working wi.docx
CSE 110 - Lab 6 What this Lab Is About  Working wi.docx
 
Should be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdfShould be in JavaInterface Worker should extend Serializable from .pdf
Should be in JavaInterface Worker should extend Serializable from .pdf
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdf
 
Preexisting code, please useMain.javapublic class Main { p.pdf
Preexisting code, please useMain.javapublic class Main {    p.pdfPreexisting code, please useMain.javapublic class Main {    p.pdf
Preexisting code, please useMain.javapublic class Main { p.pdf
 
Computer programming 2 -lesson 4
Computer programming 2  -lesson 4Computer programming 2  -lesson 4
Computer programming 2 -lesson 4
 
Junit
JunitJunit
Junit
 
Java Lab Manual
Java Lab ManualJava Lab Manual
Java Lab Manual
 
Introduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptxIntroduction of Object Oriented Programming Language using Java. .pptx
Introduction of Object Oriented Programming Language using Java. .pptx
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
 
Assignment 7
Assignment 7Assignment 7
Assignment 7
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
 
Junit_.pptx
Junit_.pptxJunit_.pptx
Junit_.pptx
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with Kotlin
 
JavaProgrammingManual
JavaProgrammingManualJavaProgrammingManual
JavaProgrammingManual
 
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxINTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
 
How to write clean tests
How to write clean testsHow to write clean tests
How to write clean tests
 
Php tests tips
Php tests tipsPhp tests tips
Php tests tips
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
 

More from aoneonlinestore1

1. VacuolesThe vacuole is an organelle in plant cells which stores.pdf
1. VacuolesThe vacuole is an organelle in plant cells which stores.pdf1. VacuolesThe vacuole is an organelle in plant cells which stores.pdf
1. VacuolesThe vacuole is an organelle in plant cells which stores.pdfaoneonlinestore1
 
1. B) - Two independent properties serve to specify the state.2. B.pdf
1. B) - Two independent properties serve to specify the state.2. B.pdf1. B) - Two independent properties serve to specify the state.2. B.pdf
1. B) - Two independent properties serve to specify the state.2. B.pdfaoneonlinestore1
 
(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdf
(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdf(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdf
(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdfaoneonlinestore1
 
I have inserted spaces. Consider f(x) belonging to f(X) thi.pdf
 I have inserted spaces. Consider f(x) belonging to f(X) thi.pdf I have inserted spaces. Consider f(x) belonging to f(X) thi.pdf
I have inserted spaces. Consider f(x) belonging to f(X) thi.pdfaoneonlinestore1
 
C program that prompts user to enter two floating point t.pdf
  C program that prompts user to enter two floating point t.pdf  C program that prompts user to enter two floating point t.pdf
C program that prompts user to enter two floating point t.pdfaoneonlinestore1
 
The carbonyl functional group in glucose is an al.pdf
                     The carbonyl functional group in glucose is an al.pdf                     The carbonyl functional group in glucose is an al.pdf
The carbonyl functional group in glucose is an al.pdfaoneonlinestore1
 
Well to find the pH at the equivalance point. Acc.pdf
                     Well to find the pH at the equivalance point. Acc.pdf                     Well to find the pH at the equivalance point. Acc.pdf
Well to find the pH at the equivalance point. Acc.pdfaoneonlinestore1
 
The weakest base in the reaction is A the enolat.pdf
                     The weakest base in the reaction is A the enolat.pdf                     The weakest base in the reaction is A the enolat.pdf
The weakest base in the reaction is A the enolat.pdfaoneonlinestore1
 
so take an aliquot of the upper layer and add a f.pdf
                     so take an aliquot of the upper layer and add a f.pdf                     so take an aliquot of the upper layer and add a f.pdf
so take an aliquot of the upper layer and add a f.pdfaoneonlinestore1
 
moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdf
                     moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdf                     moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdf
moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdfaoneonlinestore1
 
Latency is a measure of time delay experienced in.pdf
                     Latency is a measure of time delay experienced in.pdf                     Latency is a measure of time delay experienced in.pdf
Latency is a measure of time delay experienced in.pdfaoneonlinestore1
 
Entropy is the measure of disorder. Therefore, th.pdf
                     Entropy is the measure of disorder. Therefore, th.pdf                     Entropy is the measure of disorder. Therefore, th.pdf
Entropy is the measure of disorder. Therefore, th.pdfaoneonlinestore1
 
dydx = 1x dy = dxx y = ln x + c .pdf
                     dydx = 1x dy = dxx y = ln x + c               .pdf                     dydx = 1x dy = dxx y = ln x + c               .pdf
dydx = 1x dy = dxx y = ln x + c .pdfaoneonlinestore1
 
Ø Napoleonic era brought some relief to the faltering ottoman empire.pdf
Ø Napoleonic era brought some relief to the faltering ottoman empire.pdfØ Napoleonic era brought some relief to the faltering ottoman empire.pdf
Ø Napoleonic era brought some relief to the faltering ottoman empire.pdfaoneonlinestore1
 
YES=Cathode rays have mass. .yes=Matter contains positive and nega.pdf
YES=Cathode rays have mass. .yes=Matter contains positive and nega.pdfYES=Cathode rays have mass. .yes=Matter contains positive and nega.pdf
YES=Cathode rays have mass. .yes=Matter contains positive and nega.pdfaoneonlinestore1
 
TWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdf
TWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdfTWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdf
TWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdfaoneonlinestore1
 
To identify the identity of Variable Interest Entity , first of all .pdf
To identify the identity of Variable Interest Entity , first of all .pdfTo identify the identity of Variable Interest Entity , first of all .pdf
To identify the identity of Variable Interest Entity , first of all .pdfaoneonlinestore1
 
technology is the application of scientific knowledge. technology is.pdf
technology is the application of scientific knowledge. technology is.pdftechnology is the application of scientific knowledge. technology is.pdf
technology is the application of scientific knowledge. technology is.pdfaoneonlinestore1
 
b)The cations on the left side act as oxidants. C.pdf
                     b)The cations on the left side act as oxidants. C.pdf                     b)The cations on the left side act as oxidants. C.pdf
b)The cations on the left side act as oxidants. C.pdfaoneonlinestore1
 

More from aoneonlinestore1 (20)

1. VacuolesThe vacuole is an organelle in plant cells which stores.pdf
1. VacuolesThe vacuole is an organelle in plant cells which stores.pdf1. VacuolesThe vacuole is an organelle in plant cells which stores.pdf
1. VacuolesThe vacuole is an organelle in plant cells which stores.pdf
 
1. B) - Two independent properties serve to specify the state.2. B.pdf
1. B) - Two independent properties serve to specify the state.2. B.pdf1. B) - Two independent properties serve to specify the state.2. B.pdf
1. B) - Two independent properties serve to specify the state.2. B.pdf
 
(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdf
(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdf(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdf
(NH4)2SO4 is a soluble salt and is fully ionized in solution(NH4).pdf
 
I have inserted spaces. Consider f(x) belonging to f(X) thi.pdf
 I have inserted spaces. Consider f(x) belonging to f(X) thi.pdf I have inserted spaces. Consider f(x) belonging to f(X) thi.pdf
I have inserted spaces. Consider f(x) belonging to f(X) thi.pdf
 
C program that prompts user to enter two floating point t.pdf
  C program that prompts user to enter two floating point t.pdf  C program that prompts user to enter two floating point t.pdf
C program that prompts user to enter two floating point t.pdf
 
The carbonyl functional group in glucose is an al.pdf
                     The carbonyl functional group in glucose is an al.pdf                     The carbonyl functional group in glucose is an al.pdf
The carbonyl functional group in glucose is an al.pdf
 
Well to find the pH at the equivalance point. Acc.pdf
                     Well to find the pH at the equivalance point. Acc.pdf                     Well to find the pH at the equivalance point. Acc.pdf
Well to find the pH at the equivalance point. Acc.pdf
 
The weakest base in the reaction is A the enolat.pdf
                     The weakest base in the reaction is A the enolat.pdf                     The weakest base in the reaction is A the enolat.pdf
The weakest base in the reaction is A the enolat.pdf
 
so take an aliquot of the upper layer and add a f.pdf
                     so take an aliquot of the upper layer and add a f.pdf                     so take an aliquot of the upper layer and add a f.pdf
so take an aliquot of the upper layer and add a f.pdf
 
moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdf
                     moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdf                     moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdf
moles of NH4Cl formed = 20.050 = 0.1 moles so we.pdf
 
Latency is a measure of time delay experienced in.pdf
                     Latency is a measure of time delay experienced in.pdf                     Latency is a measure of time delay experienced in.pdf
Latency is a measure of time delay experienced in.pdf
 
Entropy is the measure of disorder. Therefore, th.pdf
                     Entropy is the measure of disorder. Therefore, th.pdf                     Entropy is the measure of disorder. Therefore, th.pdf
Entropy is the measure of disorder. Therefore, th.pdf
 
dydx = 1x dy = dxx y = ln x + c .pdf
                     dydx = 1x dy = dxx y = ln x + c               .pdf                     dydx = 1x dy = dxx y = ln x + c               .pdf
dydx = 1x dy = dxx y = ln x + c .pdf
 
Ø Napoleonic era brought some relief to the faltering ottoman empire.pdf
Ø Napoleonic era brought some relief to the faltering ottoman empire.pdfØ Napoleonic era brought some relief to the faltering ottoman empire.pdf
Ø Napoleonic era brought some relief to the faltering ottoman empire.pdf
 
YES=Cathode rays have mass. .yes=Matter contains positive and nega.pdf
YES=Cathode rays have mass. .yes=Matter contains positive and nega.pdfYES=Cathode rays have mass. .yes=Matter contains positive and nega.pdf
YES=Cathode rays have mass. .yes=Matter contains positive and nega.pdf
 
TWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdf
TWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdfTWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdf
TWEEN ENGINE1.Tween engine is universal.2.Reusability of tween .pdf
 
upSolutionup.pdf
upSolutionup.pdfupSolutionup.pdf
upSolutionup.pdf
 
To identify the identity of Variable Interest Entity , first of all .pdf
To identify the identity of Variable Interest Entity , first of all .pdfTo identify the identity of Variable Interest Entity , first of all .pdf
To identify the identity of Variable Interest Entity , first of all .pdf
 
technology is the application of scientific knowledge. technology is.pdf
technology is the application of scientific knowledge. technology is.pdftechnology is the application of scientific knowledge. technology is.pdf
technology is the application of scientific knowledge. technology is.pdf
 
b)The cations on the left side act as oxidants. C.pdf
                     b)The cations on the left side act as oxidants. C.pdf                     b)The cations on the left side act as oxidants. C.pdf
b)The cations on the left side act as oxidants. C.pdf
 

Recently uploaded

Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 

Recently uploaded (20)

OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 

First compile all the classes.But to run the program we have to run .pdf

  • 1. First compile all the classes.But to run the program we have to run the class which is having the main method. here TestEveryOne.java class is having the main() method.If we run the program we may get the output. Before Posting the code I checked for Errors twice,Only After ensuring that this programs are having no errors and working fine am posting.If Any Problem Happened just do comment.I will be available until you satisfied with my answer. _Thank you To Compile .java file we have to use javac command like to compile javac TestEveryOne.java To run the program we have to use java TestEveryOne. _____________________________________________________________________ TestEveryOne.java public class TestEveryOne { public static void main(String[] args) { //Creating the object of Employee Class Person person=new Person("Kane","101 Church Street","kane@gamil.com",991234568); //Displaying the Person Details System.out.println(person.toString()); //Creating the object of Student Class Student s=new Student(0) ; //Displaying the Student Details System.out.println(s.toString()); //Creating the date Class Object Date d=new Date(2016, 06, 31); //Creating the object of Employee Class Employee emp=new Employee("WIPRO", 50000, d); //Displaying the Employee Details System.out.println(emp.toString());
  • 2. //Creating the object of Faculty Class Faculty faculty=new Faculty(8, "Professor"); //Displaying the Faculty Details System.out.println(faculty.toString()); Staff staff=new Staff("Engineer"); System.out.println(staff.toString()); } } ______________________________________________________________ Person.java public class Person { //Declaring variables private String name,address,email_address; private long phone_number; //Zero Argument Constructor public Person() { super(); } //Parameterized constructor. public Person(String name, String address, String email_address, long phone_number) { super(); this.name = name; this.address = address; this.email_address = email_address; this.phone_number = phone_number; } //Setters and getters public String getName() { return name; } public void setName(String name) {
  • 3. this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getEmail_address() { return email_address; } public void setEmail_address(String email_address) { this.email_address = email_address; } public long getPhone_number() { return phone_number; } public void setPhone_number(long phone_number) { this.phone_number = phone_number; } //toString() method displays the contents of the object. @Override public String toString() { return "Person [name=" + name + ", address=" + address + ", email_address=" + email_address + ", phone_number=" + phone_number + "]"; } } __________________________________________________ Student.java public class Student extends Person { //Declaring variables private String status; //Zero Argument Constructor public Student() { super();
  • 4. } //Parameterized constructor. public Student(int status) { super(); if(status==0) this.status="Freshman"; else if(status==1) this.status="Sophomore"; else if(status==2) this.status="Junior"; else if(status==3) this.status="Senior"; } //Setters and getters public String getStatus() { return status; } public void setStatus(int status) { if(status==0) this.status="Freshman"; else if(status==1) this.status="Sophomore"; else if(status==2) this.status="Junior"; else if(status==3) this.status="Senior"; } //toString() method displays the contents of the object. @Override public String toString() { return "Student [status=" + status + "]"; } } _________________________________________________
  • 5. Employee.java public class Employee extends Person { //Declaring variables private String office; private double salary; private Date date_hired; //Zero Argument Constructor public Employee() { super(); } //Parameterized constructor. public Employee(String office, double salary, Date date_hired) { super(); this.office = office; this.salary = salary; this.date_hired = date_hired; } //Setters and getters public String getOffice() { return office; } public void setOffice(String office) { this.office = office; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } public Date getDate_hired() { return date_hired; } public void setDate_hired(Date date_hired) { this.date_hired = date_hired; }
  • 6. //toString() method displays the contents of the object. @Override public String toString() { return "Employee [office=" + office + ", salary=" + salary + ", date_hired=" + date_hired + "]"; } } ____________________________________________________________ Date.java import java.util.Calendar; public class Date { //Declaring variables private int year,month,day; //Zero Argument Constructor public Date() { super(); Calendar now = Calendar.getInstance(); // Gets the current date and time this.year=now.get(Calendar.YEAR); this.month=now.get(Calendar.MONTH); this.day=now.get(Calendar.DAY_OF_MONTH); } //Parameterized constructor. public Date(int year, int month, int day) { super(); this.year = year; this.month = month; this.day = day; } //Setters and getters public int getYear() { return year; } public void setYear(int year) { this.year = year; }
  • 7. public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } //toString() method displays the contents of the object. @Override public String toString() { return +day +"-"+month+"-"+year; } } _________________________________________________________ Faculty.java public class Faculty extends Employee { //Declaring variables private int office_hours; private String rank; //Zero Argument Constructor public Faculty() { super(); } //Parameterized constructor. public Faculty(int office_hours, String rank) { super(); this.office_hours = office_hours; this.rank = rank; } //Setters and getters public int getOffice_hours() {
  • 8. return office_hours; } public void setOffice_hours(int office_hours) { this.office_hours = office_hours; } public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank; } //toString() method displays the contents of the object. @Override public String toString() { return "Faculty [office_hours=" + office_hours + ", rank=" + rank + "]"; } } ___________________________________________________________ Staff.java public class Staff extends Person { //Declaring variables private String title; //Zero Argument Constructor public Staff() { super(); } //Parameterized constructor. public Staff(String title) { super(); this.title = title; } //Setters and getters
  • 9. public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } //toString() method displays the contents of the object. @Override public String toString() { return "Staff [title=" + title + "]"; } } _____________________________________________________________ Output: Person [name=Kane, address=101 Church Street, email_address=kane@gamil.com, phone_number=991234568] Student [status=Freshman] Employee [office=WIPRO, salary=50000.0, date_hired=31-6-2016] Faculty [office_hours=8, rank=Professor] Staff [title=Engineer] ______________________________________________________________________ Solution First compile all the classes.But to run the program we have to run the class which is having the main method. here TestEveryOne.java class is having the main() method.If we run the program we may get the output. Before Posting the code I checked for Errors twice,Only After ensuring that this programs are having no errors and working fine am posting.If Any Problem Happened just do comment.I will be available until you satisfied with my answer. _Thank you To Compile .java file we have to use javac command like to compile javac TestEveryOne.java To run the program we have to use java TestEveryOne. _____________________________________________________________________ TestEveryOne.java public class TestEveryOne {
  • 10. public static void main(String[] args) { //Creating the object of Employee Class Person person=new Person("Kane","101 Church Street","kane@gamil.com",991234568); //Displaying the Person Details System.out.println(person.toString()); //Creating the object of Student Class Student s=new Student(0) ; //Displaying the Student Details System.out.println(s.toString()); //Creating the date Class Object Date d=new Date(2016, 06, 31); //Creating the object of Employee Class Employee emp=new Employee("WIPRO", 50000, d); //Displaying the Employee Details System.out.println(emp.toString()); //Creating the object of Faculty Class Faculty faculty=new Faculty(8, "Professor"); //Displaying the Faculty Details System.out.println(faculty.toString()); Staff staff=new Staff("Engineer"); System.out.println(staff.toString()); } } ______________________________________________________________
  • 11. Person.java public class Person { //Declaring variables private String name,address,email_address; private long phone_number; //Zero Argument Constructor public Person() { super(); } //Parameterized constructor. public Person(String name, String address, String email_address, long phone_number) { super(); this.name = name; this.address = address; this.email_address = email_address; this.phone_number = phone_number; } //Setters and getters public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getEmail_address() { return email_address; } public void setEmail_address(String email_address) { this.email_address = email_address;
  • 12. } public long getPhone_number() { return phone_number; } public void setPhone_number(long phone_number) { this.phone_number = phone_number; } //toString() method displays the contents of the object. @Override public String toString() { return "Person [name=" + name + ", address=" + address + ", email_address=" + email_address + ", phone_number=" + phone_number + "]"; } } __________________________________________________ Student.java public class Student extends Person { //Declaring variables private String status; //Zero Argument Constructor public Student() { super(); } //Parameterized constructor. public Student(int status) { super(); if(status==0) this.status="Freshman"; else if(status==1) this.status="Sophomore"; else if(status==2) this.status="Junior"; else if(status==3) this.status="Senior";
  • 13. } //Setters and getters public String getStatus() { return status; } public void setStatus(int status) { if(status==0) this.status="Freshman"; else if(status==1) this.status="Sophomore"; else if(status==2) this.status="Junior"; else if(status==3) this.status="Senior"; } //toString() method displays the contents of the object. @Override public String toString() { return "Student [status=" + status + "]"; } } _________________________________________________ Employee.java public class Employee extends Person { //Declaring variables private String office; private double salary; private Date date_hired; //Zero Argument Constructor public Employee() { super(); } //Parameterized constructor. public Employee(String office, double salary, Date date_hired) { super();
  • 14. this.office = office; this.salary = salary; this.date_hired = date_hired; } //Setters and getters public String getOffice() { return office; } public void setOffice(String office) { this.office = office; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } public Date getDate_hired() { return date_hired; } public void setDate_hired(Date date_hired) { this.date_hired = date_hired; } //toString() method displays the contents of the object. @Override public String toString() { return "Employee [office=" + office + ", salary=" + salary + ", date_hired=" + date_hired + "]"; } } ____________________________________________________________ Date.java import java.util.Calendar; public class Date { //Declaring variables
  • 15. private int year,month,day; //Zero Argument Constructor public Date() { super(); Calendar now = Calendar.getInstance(); // Gets the current date and time this.year=now.get(Calendar.YEAR); this.month=now.get(Calendar.MONTH); this.day=now.get(Calendar.DAY_OF_MONTH); } //Parameterized constructor. public Date(int year, int month, int day) { super(); this.year = year; this.month = month; this.day = day; } //Setters and getters public int getYear() { return year; } public void setYear(int year) { this.year = year; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } //toString() method displays the contents of the object.
  • 16. @Override public String toString() { return +day +"-"+month+"-"+year; } } _________________________________________________________ Faculty.java public class Faculty extends Employee { //Declaring variables private int office_hours; private String rank; //Zero Argument Constructor public Faculty() { super(); } //Parameterized constructor. public Faculty(int office_hours, String rank) { super(); this.office_hours = office_hours; this.rank = rank; } //Setters and getters public int getOffice_hours() { return office_hours; } public void setOffice_hours(int office_hours) { this.office_hours = office_hours; } public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank;
  • 17. } //toString() method displays the contents of the object. @Override public String toString() { return "Faculty [office_hours=" + office_hours + ", rank=" + rank + "]"; } } ___________________________________________________________ Staff.java public class Staff extends Person { //Declaring variables private String title; //Zero Argument Constructor public Staff() { super(); } //Parameterized constructor. public Staff(String title) { super(); this.title = title; } //Setters and getters public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } //toString() method displays the contents of the object. @Override public String toString() { return "Staff [title=" + title + "]"; } } _____________________________________________________________
  • 18. Output: Person [name=Kane, address=101 Church Street, email_address=kane@gamil.com, phone_number=991234568] Student [status=Freshman] Employee [office=WIPRO, salary=50000.0, date_hired=31-6-2016] Faculty [office_hours=8, rank=Professor] Staff [title=Engineer] ______________________________________________________________________