(Employee Class) Create a class called Employee that includes three instance variablesa first name
(type String ), a last name (type String ) and a monthly salary ( double ). Provide a constructor
1
that initializes the three instance variables. Provide a set and a get method for each instance
variable. If the monthly salary is not positive, do not set its value. Write a test application named
EmployeeTest that demonstrates class Employee s capabilities. Create two Employee objects and
display each objects yearly salary. Then give each Employee a 10% raise and display each Employee
s yearly salary again
1
Expert's answer
2017-10-13T15:18:07-0400
Class Employee public class Employee { private String firstName; private String lastName; private double monthlySalary; public Employee(String firstName, String lastName, double monthlySalary) { this.firstName = firstName; this.lastName = lastName; setMonthlySalary(monthlySalary); } public double getMonthlySalary() { return monthlySalary; } public void setMonthlySalary(double monthlySalary) { if (monthlySalary >= 0) { this.monthlySalary = monthlySalary; } } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment