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

Id Firstname Lastname Salary Id Firstname Lastname Salary

This document defines an Employee class with fields for id, first name, last name, and salary. It includes getter and setter methods for these fields as well as methods to calculate annual salary, raise salary by a percentage, and return a string representation of an employee object's attributes.

Uploaded by

Mrmr Gawad
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)
30 views

Id Firstname Lastname Salary Id Firstname Lastname Salary

This document defines an Employee class with fields for id, first name, last name, and salary. It includes getter and setter methods for these fields as well as methods to calculate annual salary, raise salary by a percentage, and return a string representation of an employee object's attributes.

Uploaded by

Mrmr Gawad
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/ 1

Employee.

java

package Exam2;

public class Employee {


private int Id;
private String FirstName;
private String LastName;
private int Salary;

public Employee(int Id, String FirstName, String LastName, int Salary) {


this.Id = Id;
this.FirstName = FirstName;
this.LastName = LastName;
this.Salary = Salary;
}

public int getId() {


return Id;
}

public String getFirstName() {


return FirstName;
}

public String getLastName() {


return LastName;
}

public String getName() {


return FirstName +" "+ LastName ;
}

public int getSalary() {


return Salary;
}

public void setSalary (int Salary) {


this.Salary = Salary;
}

public int getAnnualSalary() {


return Salary * 12;
}

public int RaiseSalary(int percent) {


this.Salary = Salary * (percent/100);
return Salary;
}

public String toString() {


return "Employee [Id = " + Id + ", Name = " + this.getName() + ", Salary = " +
Salary + "]";
}
}

Page 1

You might also like