0% found this document useful (0 votes)
7 views3 pages

J 2

Sort
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)
7 views3 pages

J 2

Sort
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/ 3

package lab;

import java.util.Scanner;
class employe
{
String empname;
int empid;
String address,mailid;
int mobno,bp;
double da,hra,pf,sf,gp,ns;
Scanner sc=new Scanner(System.in);
void getdata()
{
System.out.println("Enter employe name: ");
empname=sc.nextLine();
System.out.println("Enter employe ID: ");
empid=sc.nextInt();
System.out.println("Enter Employe Mail ID: ");
sc.nextLine();
mailid=sc.nextLine();
System.out.println("Address: ");
address=sc.nextLine();
System.out.println("Mobile no: ");
mobno=sc.nextInt();
System.out.println("Basic Pay: ");
bp=sc.nextInt();
}
void display()
{
System.out.println(" EMPLOYEE DEATILS ");
System.out.println("Employe name= "+empname);
System.out.println("Employe ID= "+empid);
System.out.println("Employe Address= "+address);
System.out.println("Employe Mail ID= "+mailid);
System.out.println("Employe Mobile number= "+mobno);
}
}
class professor extends employe
{
void calculate()
{
da=bp*0.97;
hra=bp*0.10;
pf=bp*0.12;
sf=bp*0.001;
gp=bp+da+hra;
ns=gp-pf-sf;
System.out.println("Basic Pay= "+bp);
System.out.println("=DA "+da);
System.out.println("HRA= "+hra);
System.out.println("pf= "+pf);
System.out.println("SF= "+sf);
System.out.println("GP= "+gp);
System.out.println("NS= "+ns);
}
}
class assistantprofessor extends employe
{
void calculate()
{
da=bp*0.7;
hra=bp*0.10;
pf=bp*0.12;
sf=bp*0.001;
gp=bp+da+hra;
ns=gp-pf-sf;
System.out.println("Basic Pay= "+bp);
System.out.println("=DA "+da);
System.out.println("HRA= "+hra);
System.out.println("pf= "+pf);
System.out.println("SF= "+sf);
System.out.println("GP= "+gp);
System.out.println("NS= "+ns);
}
}
class associateprofessor extends employe
{
void calculate()
{
da=bp*0.6;
hra=bp*0.10;
pf=bp*0.12;
sf=bp*0.001;
gp=bp+da+hra;
ns=gp-pf-sf;
System.out.println("Basic Pay= "+bp);
System.out.println("=DA "+da);
System.out.println("HRA= "+hra);
System.out.println("pf= "+pf);
System.out.println("SF= "+sf);
System.out.println("GP= "+gp);
System.out.println("NS= "+ns);
}
}
public class payslip {
public static void main(String args[])
{
System.out.println("\n1.Professor\n2.Assistant Professor\n3.Associate
professor\n");
Scanner input=new Scanner(System.in);
System.out.println("Select Option");
int ch=input.nextInt();
switch(ch)
{
case 1:
professor p1=new professor();
p1.getdata();
p1.display();
p1.calculate();
break;
case 2:
assistantprofessor p2=new assistantprofessor();
p2.getdata();
p2.display();
p2.calculate();
break;
case 3:
associateprofessor p3=new associateprofessor();
p3.getdata();
p3.display();
p3.calculate();
break;
default:
System.out.println("Invalid Choice");
}
}
}

You might also like