CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY-TO GERNERATE EMPLOYEE SALARY SLIP PROGRAM IN JAVA
CS8382-OBJECT ORIENTED PROGRAMMING LABORATORY
TO GERNERATE EMPLOYEE SALARY SLIP PROGRAM IN JAVA
PROGRAM
import java.util.Scanner;
class Employee{
String Emp_name;
int Emp_id;
String Address;
String Mail_id;
long Mobile_no;
void display(String Emp_name,int Emp_id,String Mail_id,long Mobile_no,String Address){
System.out.println(Emp_name);
//Syetem.out.println(Address);
System.out.println(Emp_id);
System.out.println(Mail_id);
System.out.println(Mobile_no);
}
}
class Programmer extends Employee{
int BP;
/*int DA= (int) (0.97*BP);
HRA=(int) (0.10*BP);
PF=(int) (0.12*BP); */
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF:"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Assistant_Professor extends Employee{
int BP;
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF:"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Associate_Professor extends Employee{
int BP;
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF:"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Professor extends Employee{
int BP;
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF;"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Emp{
public static void main(String args[]){
String Emp_name;
int Emp_id;
String Address;
String Mail_id;
long Mobile_no;
int BP;
System.out.println("\n 1.Programmer\n2.Assistant_Professor\n3.Associate_Professor\n4.Professor");
Scanner input=new Scanner(System.in);
System.out.print("Enter an integer: ");
int ch=input.nextInt();
switch (ch) {
case 1:
Employee e1=new Employee();
Programmer p1=new Programmer();
System.out.print("Enter an Emp_name: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p1.display(BP);
e1.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 2:
Employee e2=new Employee();
Assistant_Professor p2=new Assistant_Professor();
System.out.print("Enter an integer: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p2.display(BP);
e2.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 3:
Employee e3=new Employee();
Associate_Professor p3=new Associate_Professor();
System.out.print("Enter an integer: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p3.display(BP);
e3.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 4:
Employee e4=new Employee();
Professor p4=new Professor();
System.out.print("Enter an integer: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p4.display(BP);
e4.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 5:
//exit(1);
default:
System.out.println(" Enter your correct choice");
}
}
}
class Employee{
String Emp_name;
int Emp_id;
String Address;
String Mail_id;
long Mobile_no;
void display(String Emp_name,int Emp_id,String Mail_id,long Mobile_no,String Address){
System.out.println(Emp_name);
//Syetem.out.println(Address);
System.out.println(Emp_id);
System.out.println(Mail_id);
System.out.println(Mobile_no);
}
}
class Programmer extends Employee{
int BP;
/*int DA= (int) (0.97*BP);
HRA=(int) (0.10*BP);
PF=(int) (0.12*BP); */
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF:"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Assistant_Professor extends Employee{
int BP;
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF:"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Associate_Professor extends Employee{
int BP;
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF:"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Professor extends Employee{
int BP;
void display(int BP){
System.out.println(BP);
System.out.println("DA:"+0.97*BP);
System.out.println("HRA:"+0.10*BP);
System.out.println("PF;"+0.12*BP);
System.out.println("SATFF CLUD FUND:"+0.001*BP);
}
}
class Emp{
public static void main(String args[]){
String Emp_name;
int Emp_id;
String Address;
String Mail_id;
long Mobile_no;
int BP;
System.out.println("\n 1.Programmer\n2.Assistant_Professor\n3.Associate_Professor\n4.Professor");
Scanner input=new Scanner(System.in);
System.out.print("Enter an integer: ");
int ch=input.nextInt();
switch (ch) {
case 1:
Employee e1=new Employee();
Programmer p1=new Programmer();
System.out.print("Enter an Emp_name: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p1.display(BP);
e1.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 2:
Employee e2=new Employee();
Assistant_Professor p2=new Assistant_Professor();
System.out.print("Enter an integer: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p2.display(BP);
e2.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 3:
Employee e3=new Employee();
Associate_Professor p3=new Associate_Professor();
System.out.print("Enter an integer: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p3.display(BP);
e3.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 4:
Employee e4=new Employee();
Professor p4=new Professor();
System.out.print("Enter an integer: ");
Emp_name=input.next();
System.out.print("Enter an emp_id: ");
Emp_id=input.nextInt();
System.out.print("Enter an Address: ");
Address=input.next();
System.out.print("Enter an Mail_id: ");
Mail_id=input.next();
System.out.print("Enter an Mobile_no(last 5digit only): ");
Mobile_no=input.nextInt();
System.out.print("Enter an Basicpay: ");
BP=input.nextInt();
p4.display(BP);
e4.display(Emp_name,Emp_id,Mail_id,Mobile_no,Address);
break;
case 5:
//exit(1);
default:
System.out.println(" Enter your correct choice");
}
}
}
Comments
Post a Comment