Knowee
Questions
Features
Study Tools

To automate the employee management system of ABC Bank, the below mentioned class Employee is written.  Identify the instance variables and class variables and provide the appropriate modifier.Code :public class Employee{           blank int employeeId;          blank String employeeName;           blank  double salary;           blank String companyName;}private static private

Question

To automate the employee management system of ABC Bank, the below mentioned class Employee is written.  Identify the instance variables and class variables and provide the appropriate modifier.Code :public class Employee{           blank int employeeId;          blank String employeeName;           blank  double salary;           blank String companyName;}private static private

🧐 Not the exact question you are looking for?Go ask a question

Solution

In the given code, employeeId, employeeName, and salary are instance variables. They are specific to each instance of the class Employee. The appropriate modifier for these variables would be private to ensure encapsulation in object-oriented programming. This means that these variables can only be directly accessed within the Employee class.

On the other hand, companyName could be a class variable if it's common to all employees (all instances of the class Employee). Class variables are declared with the keyword static. The appropriate modifier for this variable would be private static to ensure that this variable can only be accessed through methods of the class.

So, the corrected code would be:

public class Employee{ 
    private int employeeId; 
    private String employeeName; 
    private double salary; 
    private static String companyName;
}

Please note that the actual access modifiers depend on the specific requirements of your program.

This problem has been solved

Similar Questions

[25 points] Write a Java class named Employee such that the class contains threeattributes empName, salary, and departmentName. You should be able to createobjects of this class by supplying values to any one, two, or all three of the attributes. Ifno value is supplied during the object creation, the attributes should be initialized withsome default values. You are expected to use 'this' keyword to achieve the result. Discussthe ways in which you can change or reset the attribute values of the objects created.Write appropriate mutator methods that store values in these fields and accessormethods that return the values in these fields. Once you have written the class, write aseparate program that creates three Employee objects to hold the following data:Employee Name Department Salary---------------------------------------------------------------------Susan Meyers Accounting 5000.00Mark Jones IT 8375.00Joy Rogers Manufacturing 6380.00---------------------------------------------------------------------The program should store this data in the three objects and then display the data for eachemployee on the screen

C# simple and easy program Q1. Create an Employee class with the relevant attributes and methods in addition of thefollowing specifications:  It contains a default constructor. It contains a parameterized constructor. It contains a copy constructor.Q2. Incorporate static attributes and static methods in the Employee class where required.

How would you instantiate the Employee class from a main method located in another class?  public class Employee{    private String name;    private double salary;     public Employee(String n, double s){      name = n;      salary = s;    } }  Employee emp1 = new Employee("Syam", 50000);  Employee emp1 = new Employee(50000);  Employee emp1 = new Employee();  Employee emp1 = new Employee(50000, "Syam");

21. Write a Java program that creates a class hierarchy for employees of a company. The base class should be Employee, with subclasses Manager, Developer, and Programmer. Each subclass should have properties such as name, address, salary, and job title. Implement methods for calculating bonuses, generating performance reports, and managing projects

Q1. Create an Employee class with the relevant attributes and methods in addition of thefollowing specifications:  It contains a default constructor. It contains a parameterized constructor. It contains a copy constructor.Note: Each student should have different their own version and it is better to have morethe attributes and methods.Q2. Incorporate static attributes and static methods in the Employee class where required.note for chatgpt/bard : computer languages used for code is c#

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.