1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
White raven [17]
3 years ago
9

Create a class that represents an employee. This class will have three constructors to initialize variables. If the constructor

doesn't provide a parameter for a field, make it either "(not set)" or "0" as appropriate.
Computers and Technology
1 answer:
lawyer [7]3 years ago
8 0

Answer:

Following are the class  employee in which we create a three constructor  to initialize variables.

class employee// class

{

   public:

   int ID,age1 ; // variables

   string name1;

   employee() // constructor initialize the member with 0 when no constructor is called  

   {

     name1="0";

     age1=0;

     ID=0;

     cout<<ID<<name1<<age1;

   }

   employee(int id ,string name ,int age ) // constructor 2

   {

      ID=id;

      name1=name;

       age1=age;

       cout<<ID<<name1<<age1<<endl;

       

   }

 

   // Copy constructor

   employee(const employee(&p2) ) // constructor3

   {

       ID= p2.ID;

      name1 = p2.name1;

      age1=p2.age1;

       cout<<ID<<name1<<age1<<endl;

       

   }

};

Explanation:

Here  we create a class employee and create a three variable  ID,age1 and name1 initially  we create a default constructor in this we set all variable to 0 this constructor is call when doesn't provide any parameter to constructor after that we create a parametrized and copy constructor.In the main function we call these constructor .

Following are the program in c++ language

#include <iostream> // header file

#include <string>

using namespace std;

class employee// class

{

   public:

   int ID,age1 ; // variables

   string name1;

   employee() // constructor initialize the member with 0 when no constructor is called  

   {

     name1="0";

     age1=0;

     ID=0;

     cout<<ID<<name1<<age1;

   }

   employee(int id ,string name ,int age ) // constructor 2

   {

      ID=id;

      name1=name;

       age1=age;

       cout<<ID<<name1<<age1<<endl;

       

   }

 

   // Copy constructor

   employee(const employee(&p2) ) // constructor3

   {

       ID= p2.ID;

      name1 = p2.name1;

      age1=p2.age1;

       cout<<ID<<name1<<age1<<endl;

       

   }

};

int main() // main function

{

cout<<"first constructor"<<endl;

employee e; // call constructor doesn't provide a parameter

cout<<endl<<" second constructor"<<endl;

employee e1(13,"ss",67);// call the second constructor

cout<<" third constructor"<<endl;  

employee p2 =e1;// call third constructor

return 0;

}

Output:

first constructor

000

second constructor

3ss67

third constructor

3ss67

You might be interested in
A_______ to show the working of an object before it is built or made. A. Prototype b. Test c. Evaluation d. Plan
tresset_1 [31]

Answer:

A. Prototype

Explanation:

8 0
3 years ago
The answer for 1 and 2
Mrrafil [7]
1. A.  It is basically the definition of a political cartoon.
2. D. They used newspaper, protesting, and marches.
<span />
6 0
4 years ago
We are committed to creating and cultivating a graduate and postdoctoral community that values and respects individuals, regardl
kykrilka [37]

Answer:

I will contribute to enhance the academic, cultural, and intellectual environment for graduate students and postdoctoral at the University of Connecticut in the following ways:

  • Participating in events.
  • Establishing importance for cultural environment.
  • Informing people by conducting social seminars.
  • Picturing the benefits of academic environment.

Explanation:

Following is the explanation for each of the steps stated above.

      1. Participating in events:

                       All students must be guided to participate and perform in the events conducted. These guidelines should be made mandatory for each pupil to follow so that they may be aware of benefits of the events by being social.

      2. Establishing importance for cultural environment:

                   Cultural festivals should be arranged by the universities so that the importance of such events could be realized by the students. Rules and regulation must be followed by each student so that a cultural environment may be established.

      3. Informing people by conducting social seminars:

                  Introductory seminars play an important role in changing the minds and thoughts of the students and social members. So in order to make society a best place it is necessary to make people aware of morals of society. Therefore conducting seminars is a key to good moral awareness.

       4. Picturing the benefits of academic environment:

                      Each student must know about the benefits of keeping interests in academic. In order to built an academic environment among the universities it is better to picture the future aspects and benefits o such interests so that the pupils keep believe on the academic interests by heart.

<h3>I hope it will help you!</h3>

                       

3 0
4 years ago
Cryptography is the science of secret writing. Cryptography involves creating written or generated codes that allow information
Rudiy27

Answer:

true

Explanation:

the answer is true dude

5 0
2 years ago
A(an) _______ is a set of instructions that a computer follows to perform a task.
Vikentia [17]
A(an) _______ is a set of instructions that a computer follows to perform a task.Answer is Program .
I hope the answer of the question.
7 0
4 years ago
Other questions:
  • The students of a college have to create their assignment reports using a word processing program. Some of the questions in thei
    5·2 answers
  • The process of recognizing information? needs, using efficient search techniques to locate reliable sources of? information, and
    9·1 answer
  • Write an expression using membership operators that prints "Special number" if special_num is one of the special numbers stored
    12·1 answer
  • What are 2 main differences betweenarrays andstructs?
    7·1 answer
  • 19. Fair use applies to which of the following situations?
    14·1 answer
  • What does "scanf(\"%d\" mean?
    13·2 answers
  • What game is this? help mee?
    8·2 answers
  • Why is time zone an important factor affecting when communicating
    14·1 answer
  • after landing, you are tying down the aircraft when a person approaches and asks: "faa. are you the pilot of this aircraft?" wha
    11·1 answer
  • attackers typically use ack scans to get past a firewall or other filtering device. how does the process of an ack scan work to
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!