Create a class called Employee that includes three pieces of information as instance variables a first name (type String), a last name (type String) and a monthly salary (double). Your class should have a constructor that initializes the three instance variables. Provide a set and a get method for each instance variable. Write a test application named EmployeeTest that demonstrates class Employee's capabilities. Create two Employee objects and display each object's yearly salary. Then give each Employee a 10% raise and display each Employee's yearly salary again.


Updated: Nov. 27, 2020 — Training Time: 3 minutes
Overseen by: Archangel Macsika
Topic:Generic - Java Programming

Difficulty: Advance.

Companies who previously asked this: -.

Objective: Create a class called Employee that includes three pieces of information as instance variables a firstName (type String), a lastName (type String) and a monthly salary (type double). Your class should have a constructor that initializes the three instance variables. Provide a setter and a getter method for each instance variable. Write a test application named EmployeeTest that demonstrates class Employee's capabilities. Create two Employee objects and display each object's yearly salary. Then give each Employee a 10% raise and display each Employee's yearly salary again.

Input: Name of employee and salary.

Expected Output: Displays the yearly salary, and the yearly salary after a 10% raise based on the user input.

Sikademy Solution

Employee.java

EmployeeTest.java

Was this training resource helpful?