1. Employee class diagram. The method raiseSalary(percent) increases the salary by the given percentage. Write the Emplo

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

1. Employee class diagram. The method raiseSalary(percent) increases the salary by the given percentage. Write the Emplo

Post by answerhappygod »

1. Employee class diagram. The method raiseSalary(percent)increases the salary by the given percentage. Write the Employeeclass.
(Note: requirement language is java)
1 Employee Class Diagram The Method Raisesalary Percent Increases The Salary By The Given Percentage Write The Emplo 1
1 Employee Class Diagram The Method Raisesalary Percent Increases The Salary By The Given Percentage Write The Emplo 1 (17.33 KiB) Viewed 52 times
The test driver to test Employee class.
public class TestMain {
public static voidmain(String[] args) {
// Testconstructor and toString()
Employee e1 = new Employee(8, "Peter", "Tan", 2500);
System.out.println(e1); // toString();
// TestSetters and Getters
e1.setSalary(999);
System.out.println(e1); // toString();
System.out.println("id is: " + e1.getID());
System.out.println("firstname is: " + e1.getFirstName());
System.out.println("lastname is: " + e1.getLastName());
System.out.println("salary is: " + e1.getSalary());
System.out.println("name is: " + e1.getName());
System.out.println("annual salary is: " + e1.getAnnualSalary()); //Test method
// TestraiseSalary()
System.out.println(e1.raiseSalary(10));
System.out.println(e1);
}
ExpectedOutput:
Employee[id=8,name=PeterTan,salary=2500]
Employee[id=8,name=PeterTan,salary=999]
id is: 8
firstname is: Peter
lastname is: Tan
salary is: 999
name is: Peter Tan
annual salary is: 11988
1098
Employee[id=8,name=PeterTan,salary=1098]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply