0% found this document useful (0 votes)
13 views2 pages

Activity Midterm 2 V 2

The document defines two classes, Person and Employee, where Employee extends Person. It includes constructors for both classes and methods to display personal and employee information. The main method creates instances of Person and Employee and displays the employee's information.

Uploaded by

loida.04bautista
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Activity Midterm 2 V 2

The document defines two classes, Person and Employee, where Employee extends Person. It includes constructors for both classes and methods to display personal and employee information. The main method creates instances of Person and Employee and displays the employee's information.

Uploaded by

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

class Person {

private String name;


private String birthdate;
private int age;
private String address;
private String mobileNumber;

// Constructor
public Person(String name, String birthdate, int age, String address, String
mobileNumber) {
this.name = name;
this.birthdate = birthdate;
this.age = age;
this.address = address;
this.mobileNumber = mobileNumber;
}

// Display Person Information


public void displayPersonInfo() {
System.out.println("Person Information:");
System.out.println("Name: " + name);
System.out.println("Birthdate: " + birthdate);
System.out.println("Age: " + age);
System.out.println("Address: " + address);
System.out.println("Mobile Number: " + mobileNumber);
System.out.println();
}
}

class Employee extends Person {


private String employeeName;
private String employeeNumber;
private String status;
private int employeeAge;
private String jobTitle;

// Constructor
public Employee(String name, String birthdate, int age, String address, String
mobileNumber,
String employeeName, String employeeNumber, String status, int
employeeAge, String jobTitle) {
super(name, birthdate, age, address, mobileNumber);
this.employeeName = employeeName;
this.employeeNumber = employeeNumber;
this.status = status;
this.employeeAge = employeeAge;
this.jobTitle = jobTitle;
}

// Display Employee Information


public void displayEmployeeInfo() {
displayPersonInfo();
System.out.println("Employee Information:");
System.out.println("Name: " + employeeName);
System.out.println("Employee Number: " + employeeNumber);
System.out.println("Status: " + status);
System.out.println("Age: " + employeeAge);
System.out.println("Job Title: " + jobTitle);
}
}

public class Main {


public static void main(String[] args) {
// Create Person and Employee objects
Person person = new Person("Jon Dew", "August 04, 1994", 30, "167 New York
street", "442-92-90");
Employee employee = new Employee("Jon Dew", "August 04, 1994", 30, "167 New
York street", "442-92-90",
"Jane Doe", "0182911", "Single", 28,
"Software Developer");

// Display Information
employee.displayEmployeeInfo();
}
}

You might also like