0% found this document useful (0 votes)
15 views4 pages

Traineeemployees - Java: Public Class Extends Private Int Private Int Public Int Return

java coding

Uploaded by

Akash Modi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Traineeemployees - Java: Public Class Extends Private Int Private Int Public Int Return

java coding

Uploaded by

Akash Modi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TraineeEmployees.

java

public class TraineeEmployees extends Employee {

private int supplementaryTrainingHours;


private int scorePoints;

public int getSupplementaryTrainingHours() {


return supplementaryTrainingHours;
}

public void setSupplementaryTrainingHours(int supplementaryTrainingHours)


{
this.supplementaryTrainingHours = supplementaryTrainingHours;
}
public int getScorePoints()
{
return scorePoints;
}
public void setScorePoints(int scorePoints)
{
this.scorePoints = scorePoints;
}

public traineeEmployees(String employeeId,String employeeName, int


yearsOfExperience, String gender,
double salary, int supplementaryTrainigHours, int scorePoints)
{
super( employeeId, employeeName, yearsOfExperience, gender,
salary);
this.supplementaryTrainingHours = supplementaryTrainingHours;
this.scorePoints = scorePoints;
}
public double calculateIncrementedSalary(int incrementPercentage)
{
double totalSalary =
(supplementaryTrainingHours*500)+(scorePoints*50)+salary;
double incrementedsalary =
totalsalary+(totalsalary*incrementPercentage/100);
return incrementedSalary;
}
}
CasualEmployee.java

public class CasualEmployee extends Employee {

private int supplementaryHours;


private double foodAllowance;

public CasualEmployee(String employeeId,String employeeName, int


yearsOfExperience, String gender,
double salary,int supplementaryHours, double foodAllowance)
{
super( employeeId, employeeName, yearsOfExperience, gender,
salary);
this.supplementaryHours = supplementaryHours;
this.foodAllowance = foodAllowance;
}
public int getSupplementaryHours() {
return supplementaryHours;
}
public void setSupplememtaryHours(int supplementaryHours)
{
this.supplementaryHours = supplementaryHours;
}
public double getFoodAllowance() {
return foodAllowance;
}
public void setFoodAllowance(double foodAllowance)
{
this.foodAllowance = foodAllowance;
}
public double calculateIncrementedSalary(int incrementPercentage)
{
double totalSalary=(supplementaryHours*1000)+foodAllowance +salary;
double incrementedSalary =
totalSalary+(totalSalary*incrementPercentage/100);
return incrementedSalary;
}
}
PermanentEmployee.java

public class PermanentEmployee extends Employee {

private double medicalAllowance;


private double vehicleAllowance;

public double getMedicalAllowance()


{
return medicalAllowance;
}
public void setMedicalAllowance(double medicalAllowance)
{
this.medicalAllowance = medicalAllowance;
}
public double getVehicleAllowance()
{
return vehicleAllowance;
}
public void setMedicalAllowance(double vehicleAllowance)
{
this.medicalAllowance = medicalAllowance;
}
public PermanentEmployee(String employeeId,String employeeName, int
yearsOfExperience, String gender,
double salary, double medicalAllowance, double
vehicleAllowance)
{
super( employeeId, employeeName, yearsOfExperience, gender,
salary);
this.medicalAllowance = medicalAllowance;
this.vehicleAllowance = vehicleAllowance;
}

public double calculateIncrementedSalary(int incrementPercentage)


{
double totalSalary = medicalAllowance + vehicleAllowance+salary;
double incrementedSalary =
totalSalary+(totalSalary*incrementPercentage/100);
return incrementedSalary;
}
}
UserInterface.java

import java.util.Scanner;

public class UserInterface {

public static void main(String[] args) {


Scanner sc = new Scanner(System.in);
System.out.println("Enter Employee Id");
String eid = sc.next();
System.out.println("Enter Employee name");
String ename = sc.next();
System.out.println("Enter Experience in years");
int eyear = sc.nextInt();
System.out.println("Enter Gender");
String egender = sc.next();
System.out.println("Enter Salary");
double esalary = sc.nextDouble();
double ans = 0;

if(eyear>=1 && eyear<=5) {


System.out.println("Enter Supplementary Training Hours");
int esth = sc.nextInt();
System.out.println("Enter Score Points");
int esp = sc.nextInt();
TraineeEmployees te = new
TraineeEmployees(eid,ename,eyear,egender,esalary,esth,esp);
ans = te.calculateIncrementedSalary(5);
}
else if(eyear>=6 && eyear<=10) {
System.out.println("Enter Supplementary Hours");
int esh = sc.nextInt();
System.out.println("Enter Food Allowance");
double efa = sc.nextDouble();
CasualEmployee ce = new
CasualEmployee(eid,ename,eyear,egender,esalary,esh,efa);
ans = ce.calculateIncrementedSalary(12);
}
else if(eyear>=11 && eyear<=25) {
System.out.println("Enter Medical Allowance");
double ema = sc.nextDouble();
System.out.println("Enter Vehicle Allowance");
double eva = sc.nextDouble();
PermanentEmployee pe =new
PermanentEmployee(eid,ename,eyear,egender,esalary,ema,eva);
ans = pe.calculateIncrementedsalary(12);
}
else {
System.out.println("Provide valid Years of Experience");
}
if(eyear>=1 && eyear<=5 || eyear>=6 && eyear<=10 || eyear>11 &&
eyear<=25) {
System.out.println("Incremented Salary is "+ ans);
}
}
}

You might also like