You are on page 1of 3

Object Oriented Programming (BCA202)

An Object Oriented Programming Lab report submitted in partial fulfillment


of the requirements for the degree of BCA

Submitted by
Name: Syeda Farheen
Roll No: 20201BCA0067

Laboratory Instructor
Mr.B. Prabhu Shankar

Department of Computer Science and Engineering


PRESIDENCY UNIVERSITY, BANGALORE
Karnataka- 560064, India
LAB-11
a package named "Presidency". Under this create two packages named "Employee" and "Student".
Under the employee package create a class called "EmployeeDetails" having required member
fields and methods. Under the Student package create a class called "StudentDetails" having
required member fields and methods. Demonstrate the above by creating objects of StudentDetails
and EmployeeDetails inside another class which resides in another package.Hint: You can assume
the relevant fields and methods to be written inside the EmployeeDetails and
StudentDetails class.

Procedure:

1. Define the package employee and class employeedetails class inside it.
2. Define the package student and class studentdetails inside it.
3. Create the another class and import the employee and student class details and
printinside it.

Tools Used
JDK / Eclipse/ Netbeans / notepad++ / online java compiler
package employee; public
class employeedetails
{ public void
print_emp_details()
{
System.out.println("The employee name is john");
System.out.println("The Salary is 2,00,000");
}
}

package student; public


class studentdetails
{
public void print_student_details()
{
System.out.println("The student name is john");

System.out.println("The Student id is 1002");


}
}

import employee.employeedetails;
import student.studentdetails;
public class printdetails
{
public static void main(String args[])
{ employeedetails emp=new
employeedetails(); studentdetails std=new
studentdetails(); emp.print_emp_details();
std.print_student_details();
}
}
OUTPUT

You might also like