Multiple choice technology programming languages

You are required to represent the employees at a company in Java code. The employees are categorized according to their position and salary. You also need to be able to change the state of an employee due to a promotion. How could you represent this?

  1. Create a Salary object

  2. Declare an Employee class

  3. Declare an instance of the Employee class called Promotion

  4. Declare a promotion method that changes the value of the position variable

  5. Define variables for position and salary

Reveal answer Fill a bubble to check yourself
B,D,E Correct answer
Explanation

To represent employees in Java, you define an Employee class containing variables for position and salary. A method (like promote) is used to change the position variable's value to represent a promotion. Creating a Promotion instance or a standalone Salary object is unnecessary.