Created
July 21, 2019 04:17
-
-
Save rohitvvv/896f3ebc81a7183451d8da4a72c53dc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Employee { | |
int employeeId; | |
String firstName; | |
String middleName; | |
String lastName; | |
int experience; | |
int salary; | |
public void calculateSalary() { | |
if (experience < 5) { | |
salary = 2000; | |
} | |
if (experience > 5 && experience < 10) { | |
salary = 5000; | |
} | |
if (experience < 15) { | |
salary = 10000; | |
} | |
} | |
String getDesignation() { | |
if (experience < 2) { | |
return "D2"; | |
} | |
if (experience < 5 && experience > 2) { | |
return "D3"; | |
} | |
if (experience > 10) { | |
return "M1"; | |
} | |
return "CEO"; | |
} | |
Employee(String firstName, String middleName, String lastName) { | |
this.firstName = firstName; | |
this.middleName = middleName; | |
this.lastName = lastName; | |
} | |
public void setEmployeeId(int x) { | |
this.employeeId = x; | |
} | |
public void printEmployeeDetails() { | |
System.out.println("This method will print employee details"); | |
} | |
public Double employeeMagicMethod() { | |
return Math.random(); | |
} | |
public static void main(String[] args) { | |
Employee employee = new Employee("Mohandas", "Karamchand", "Gandhi"); | |
employee.setEmployeeId(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment