Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- Employee[] x = new Employee[3];
- public static void main(String[] args) {
- Test m = new Test();
- m.createEmployees();
- }
- public void createEmployees() {
- x[0] = new Employee();
- x[1] = new Employee();
- x[2] = new Employee();
- x[0].setName("nimal");
- x[0].setSalary(5000);
- x[0].setEmployee_number(2);
- x[1].setName("sunil");
- x[1].setSalary(70000);
- x[1].setEmployee_number(1);
- x[2].setName("kamal");
- x[2].setSalary(80000);
- x[2].setEmployee_number(3);
- for (int i = 0; i < 3; i++) {
- if (x[i].getSalary() > 10000) {
- double s = x[i].getSalary() * 0.9;
- System.out.println(x[i].getName() + "'s salary in august is " + s);
- } else {
- System.out.println(x[i].getName() + "'s salry is " + x[i].getSalary());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment