Question

Suppose Employee is a class and dilbert is an object of class Employee. Class Employee has...

Suppose Employee is a class and dilbert is an object of class Employee. Class Employee has three private instance variables, name, phone, and email. How would dilbert access the instance variables, to give them values, if outside of class Employee?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

It will assign the values using the constructor or setters and it will access the values using the getters

or class Employee should make the frienship with class or function where  dilbert exist

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Suppose Employee is a class and dilbert is an object of class Employee. Class Employee has...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Suppose Employee is a class and Jerry is an object of class Employee. Class Employee has...

    Suppose Employee is a class and Jerry is an object of class Employee. Class Employee has three public instance variables, name, phone, and email. How would Jerry access the instance variables, to give them values, if inside of class Employee? Java programming.

  • Write a Java class named Employee to meet the requirements described in the UML Class Diagram...

    Write a Java class named Employee to meet the requirements described in the UML Class Diagram below: Note: Code added in the toString cell are not usually included in a regular UML class diagram. This was added so you can understand what I expect from you. If your code compiles cleanly, is defined correctly and functions exactly as required, the expected output of your program will solve the following problem: “An IT company with four departments and a staff strength...

  • Following is the EmployeeTester class, which creates object of the class Employee and calls the methods...

    Following is the EmployeeTester class, which creates object of the class Employee and calls the methods of that object. The EmployeeTester class is written to test another class: Employee. You are required to implement the class Employee by: declaring its instance variables: name, age, salary. implementing its constructor. implementing its methods: getEmployeeName(), getEmployeeAge(), getEmployeeSalary(), setEmployeeAge(int empAge),      setEmployeeSalary(double empSalary) public class EmployeeTester { public static void main(String args[]) { // Construct an object Employee employeeOne = new Employee("Ahmad Abdullah"); //...

  • project-8c Write a class named Employee that has data members for an employee's name, ID_number, salary,...

    project-8c Write a class named Employee that has data members for an employee's name, ID_number, salary, and email_address (you must use those names - don't make them private). Write a function named make_employee_dict that takes as parameters a list of names, a list of ID numbers, a list of salaries and a list of email addresses (which are all the same length). The function should take the first value of each list and use them to create an Employee object....

  • in Java Create an object class for the Employee Master (Employee). Select data types that will...

    in Java Create an object class for the Employee Master (Employee). Select data types that will best represent the data to be stored. All variables are to be declared with a private access modifier. Provide assessor/mutator methods for each instance field. Also provide a display data method that displays all of the instance fields of the class. Be sure each field is preceded by the text name of the field. Employee Master (Employee) Employee Number                              Numeric                 0 decimals, max size...

  • Create another Java class named EmployeeMain within the same project, which includes the main method. a....

    Create another Java class named EmployeeMain within the same project, which includes the main method. a. Include another class named Employee in the same Java file. This class has the following instance variables and instance methods. Define all the instance/static variables with private access modifier and constructors, instance/static methods with public access modifier. Instance Variables empID: int employeeName: String basicSalary: double Constructor Set the value for empID. Instance Methods Get and set methods for all instance variables. displayEmployee: Display the...

  • class employee                                         

    class employee                                                                                    //Line 1 {                                                                                                          //Line 2 public:                                                                                     //Line 3 employee();                                                                 //Line 4 employee(string, int, double);                                     //Line 5 employee(int, double);                                                //Line 6 employee(string);                                                        //Line 7 void setData(string, int, double);                                //Line 8 void print() const;                                                       //Line 9 void updateSalary(double x);                         //Line 10 int getNumOfServiceYears() const;               //Line 11 double getSalary() const;                                            //Line 12 private:                                                                                    //Line 13 string name;                                                                //Line 14 int numOfServiceYears;                                             //Line 15 double salary;                                                             ...

  • It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming...

    It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming Challenge 2 Employee Class.pdf Program Template: // Chapter 13, Programming Challenge 2: Employee Class #include <iostream> #include <string> using namespace std; // Employee Class Declaration class Employee { private: string name; // Employee's name int idNumber; // ID number string department; // Department name string position; // Employee's position public: // TODO: Constructors // TODO: Accessors // TODO: Mutators }; // Constructor #1 Employee::Employee(string...

  • a c++ program (The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person...

    a c++ program (The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has an office, salary, and date hired. Use the MyDate classto create an object for date hired. A faculty...

  • Java - Object Oriented Programming Declare a class named Customer that has two private fields? Write...

    Java - Object Oriented Programming Declare a class named Customer that has two private fields? Write a set method to make sure that if age > 125 years or less than 0 then it is set to 0 (default value) What does it indicate when declaring a class's instance variables with private access modifier? What is the role of a constructor? The data part of by an object's instance variables is known as? Do all methods have to always return...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT