0% found this document useful (0 votes)
2 views

Assignment oop3

The document is a Java program that defines an employee management system with classes for Employee, Programmer, TeamLead, and ProjectManager. Each class allows for input of employee details, calculation of salaries, and display of information. The main class provides a menu for user interaction to manage different types of employees and their salary calculations.

Uploaded by

joshishridhar186
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)
2 views

Assignment oop3

The document is a Java program that defines an employee management system with classes for Employee, Programmer, TeamLead, and ProjectManager. Each class allows for input of employee details, calculation of salaries, and display of information. The main class provides a menu for user interaction to manage different types of employees and their salary calculations.

Uploaded by

joshishridhar186
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 asss3;

import java.util.Scanner;

class Employee
{
String emp_name, address, mail_id;
long mobile_no;
int emp_id;
double basic_pay;

void getdata()
{
System.out.println("Enter the following data:\n");
System.out.println("Employee name: ");
Scanner s1 = new Scanner(System.in);
emp_name= s1.nextLine();
System.out.println("Employee ID: ");
Scanner s2 = new Scanner(System.in);
emp_id= s2.nextInt();
System.out.println("Employee address: ");
Scanner s3= new Scanner(System.in);
address= s3.nextLine();
System.out.println("Employee Mail: ");
Scanner s4= new Scanner(System.in);
mail_id= s4.nextLine();
System.out.println("Employee Mobile number: ");
Scanner s5 = new Scanner(System.in);
mobile_no= s5.nextLong();
}

void display()
{
System.out.println("Employee name: "+emp_name+"\nEmployee ID: "+emp_id+"\nEmployee
address: "+address+"\nEmployee Mail: "+mail_id+"\nEmployee Mobile number:
"+mobile_no+"\n");

}
}

class Programmer extends Employee


{
double basic_pay,da,hra,pf,scf,net,gross;
void cal()
{
System.out.println("Employee Basic Pay: ");
Scanner s6= new Scanner(System.in);
basic_pay=s6.nextDouble();
da=0.97*basic_pay;
hra=0.1*basic_pay;
pf=0.12*basic_pay;
scf=0.01*basic_pay;
gross=basic_pay+da+hra;
net=gross-pf-scf;
}
void displayinfo()
{
System.out.println("Gross Salary"+gross+"\nNet Salary: " +net);
}
}

class TeamLead extends Employee


{
double basic_pay,da,hra,pf,scf,net,gross;
void cal()
{
System.out.println("Employee Basic Pay: ");
Scanner s7= new Scanner(System.in);
basic_pay=s7.nextDouble();
da=0.97*basic_pay;
hra=0.1*basic_pay;
pf=0.12*basic_pay;
scf=0.01*basic_pay;
gross=basic_pay+da+hra;
net=gross-pf-scf;
}
void displayinfo()
{
System.out.println("Gross Salary"+gross+"\nNet Salary: " +net);
}
}

class ProjectManager extends Employee


{
double basic_pay,da,hra,pf,scf,net,gross;
void cal()
{
System.out.println("Employee Basic Pay: ");
Scanner s8= new Scanner(System.in);
basic_pay=s8.nextDouble();
da=0.97*basic_pay;
hra=0.1*basic_pay;
pf=0.12*basic_pay;
scf=0.01*basic_pay;
gross=basic_pay+da+hra;
net=gross-pf-scf;
}
void displayinfo()
{
System.out.println("Gross Salary"+gross+"\nNet Salary: " +net);
}
}

public class Assignment3


{
public static void main(String args[])
{
while(true)
{
System.out.println("\nEnter your choice for \n 1.Programmer \n 2.TeamLead \n
3.Project Manager \n");
Scanner sc= new Scanner(System.in);
int ch;
ch=sc.nextInt();
switch(ch)
{

case 1:
Programmer obj1= new Programmer();
obj1.getdata();
obj1.display();
obj1.cal();
obj1.displayinfo();
break;

case 2:
TeamLead obj2= new TeamLead();
obj2.getdata();
obj2.display();
obj2.cal();
obj2.displayinfo();
break;

case 3:
ProjectManager obj3= new ProjectManager();
obj3.getdata();
obj3.display();
obj3.cal();
obj3.displayinfo();
break;

case 4:
System.exit(0);
default:
System.out.println("Enter proper choice ");
}
}
}
}

You might also like