Generation

generate functionTue, 24 Jan 2023

You want to store information about the employees of a company. For each For each employee we want to store the following information: employee number, name, year of incorporation in the company, name of the department to which The employee number, name, year of incorporation in the company, name of the department to which he/she belongs, salary and occupation. The company has only 3 departments: Sales, Marketing and Development. When the user is prompted for the data, the user will enter 10, 20 or 30 respectively, and the department will be assigned to the department will be assigned to the object using an enum type (research on this data type). From the same way, the available departments are: PROGRAMMER, ANALYST and PROJECT MANAGER. Without However, when entering the data, the user will enter 1, 2 or 3, respectively, and the trade will be assigned to the the office will be assigned to the Employee object using an enum type. The constructor of the class will be all data will be passed to the constructor of the class except the employee number which will be a generated number (the first employee to be employee number 1 will be assigned to the first employee, the second employee number 2 and so on). and so on). The employee will have a toString method and an equals method.

public enum Department { SALES(10), MARKETING(20), DEVELOPMENT(30); private final int value; private Department(int value) { this.value = value; } public int getValue() { return value; } } public enum Occupation { PROGRAMMER(1), ANALYST(2), PROJECT_MANAGER(3); private final int value; private Occupation(int value) { this.value = value; } public int getValue() { return value; } } public class Employee { private static int numberOfEmployees = 0; private int number; private String name; private int yearOfIncorporation; private Department department; private double salary; private Occupation occupation; public Employee(String name, int yearOfIncorporation, int dep, double salary, int occ) { this.name = name

Questions about programming?Chat with your personal AI assistant