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
Writing down your main ideas, subpoints, and supporting material, then using geometric shapes and arrows to indicate logical rel
horsena [70]

The process that involves writing down your main ideas, subpoints, and supporting material, then using geometric shapes is mapping.

This includes uses of  arrows to indicate logical relationships.

<h3>What is mapping?</h3>

mapping can be regarded as the prescribed way of assigning an object to each object in one set a particular object.

Learn more about mapping at:

brainly.com/question/25168859

7 0
3 years ago
It's possible to __________ out of a loop if the user has entered an incorrect value that would cause an error or a problem with
Stella [2.4K]

Answer:

The answer is Break

<u>Explanation:</u>

When break statement is occurred then, it immediately exits from the loop and executed the statement after the loop without raising any kind of error.

<u>The situation after entering of a value by a user </u>

  • If the user entered incorrect value then it will exit from the loop.
  • If the user entered correct input value, then it will run the loop for the further values.

4 0
3 years ago
Im bored anyone up for a convo? lets talk.. =D
aleksandrvk [35]

Answer:

ok im fine with dat <3

6 0
3 years ago
Read 2 more answers
Which symbol would be used in a flowchart to represent a connection to another part of the flowchart on the same page
AlekseyPX

Answer:

The answer is "Connectors".

Explanation:

Please find the Connectors image in the attached file.

In this question, the connectors symbol is usually small throughout the flowcharts. It is used as a connection to display and changes throughout the flux. It was usually marked by major letters that indicate jump points. This diagram visually shows the sequence of events in a system and who is accountable.

7 0
3 years ago
Which type of RAM is used exclusively in laptops?<br> a) SODIMM<br> b) DDR3<br> c) DDR<br> d) DDR4
Black_prince [1.1K]

Answer:

DDR3

Explanation:

6 0
3 years ago
Other questions:
  • Optimally, the __________ guides investment decisions and decisions on how ISs will be developed, acquired, and/or implemented.
    6·1 answer
  • Describe how to manipulate artwork in a presentation.
    13·1 answer
  • Specifically describe the design process for an Android phone application.
    12·1 answer
  • Why should characters be avoided in file names
    11·1 answer
  • Write a C function which mimics the behavior of the assembly language function below. Note that this time, the assembly language
    10·1 answer
  • In vehicles equipped with ABS, the driver's foot must remain firmly on the _________ to activate the ABS.
    7·2 answers
  • Does anyone know what i did wrong?
    13·1 answer
  • . Imagine that you were programming without an IDE. What problems might you encounter?​
    12·1 answer
  • What will be displayed after this code segment is run?
    5·1 answer
  • Every windows service has the 3 start types what are those service types?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!