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 Correct answer
Explanation

You should declare an Employee class to represent employee objects with position and salary attributes. A promotion method within this class would allow changing these attributes. Option A is too narrow, C is an instance not a class design, and E lacks object-oriented structure.