Java Lab Exercise 5: Employee Management System with Inheritance, Assignments of Java Programming

Java lab exercises that include the codes for java classes ,construtor,operator overloading and basics

Typology: Assignments

2020/2021

Uploaded on 02/22/2022

arun-kumawat-20bce1226
arun-kumawat-20bce1226 🇮🇳

5 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
20BCE1226
ARUN KUMAWAT
CSE1007 JAVA Lab exercise-5
import java.util.*;
// Publisher class
class employee
{
int emp_id;
String name,designation;
employee(int p,String d, String e)
{
emp_id=p;
name =d;
designation=e;
}
void display()
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Java Lab Exercise 5: Employee Management System with Inheritance and more Assignments Java Programming in PDF only on Docsity!

20BCE

ARUN KUMAWAT

CSE1007 JAVA Lab exercise- 5

import java.util.*; // Publisher class class employee { int emp_id; String name,designation; employee(int p,String d, String e) { emp_id=p; name =d; designation=e; } void display()

System.out.print(emp_id+"\t"); System.out.print(name+"\t"); System.out.print(designation+"\t"); System.out.println(); } } // Inherited permanent class class permanent extends employee { double bp,gp,np; permanent(int p,String d ,String e ,double a) { super(p,d,e); bp=a; gp=bp+ (bp15)/100 +8000+ (((bp15)/100)5)/100; np=gp-(2gp)/100-1250; } void display() { System.out.println("LIST OF ALL permanent employee"); System.out.print(bp+"\t"); System.out.print(gp+"\t"); System.out.print(np+"\t"); super.display(); } } // Inherited temporary class class temporary extends employee { double salary_per_hour,total_hours,total_salary;

public static void main(String[] args) { permanent pe[]=new permanent[5]; for(int i=0;i<3;i++) { Scanner s= new Scanner(System.in); System.out.println("Enter employee id :"); int p=s.nextInt(); System.out.println("Enter employee name :"); String d=s.next(); System.out.println("Enter designation of employee :"); String e=s.next(); System.out.println("Enter Basic pay :"); double a=s.nextDouble(); pe[i]=new permanent(p,d,e,a); } for(int i=0;i<3;i++) { pe[i].display(); } temporary te[]=new temporary[5]; for(int i=0;i<3;i++) { Scanner s= new Scanner(System.in); System.out.println("Enter employee id :"); int p=s.nextInt(); System.out.println("Enter employee name :"); String d=s.next();

System.out.println("Enter designation of employee :"); String e=s.next(); System.out.println("Enter salary per hour :"); double q=s.nextDouble(); System.out.println("Enter total number of hours :"); double r=s.nextDouble(); te[i]=new temporary(p,d,e,q,r); } for(int i=0;i<3;i++) { te[i].display(); } search(pe,3,"Arun"); } }