Answer to Question #347471 in C++ for Duewinno Ocaña

Question #347471

Write a program that would print the information (name, year of joining, salary, address) of the employee by creating a class named employee.The output should be as fallow.




Name year of joining address




Robert 1994 64C- wallstreat




Sam 2000 68D- wallstreat




John 1999 26B- wallstreat

1
Expert's answer
2022-06-02T10:27:27-0400
#include <iostream>
#include <string>

using namespace std;

class Employee
{
private:

    string name;
    int year;
    string address;

public:

    void Initialize(string n, int y, string a)
    {
          name = n;
          year = y;
          address = a;
     }

     void Display()
     {
          cout << name << "\t" << year << "\t" << address << endl;
     }
};

int main()
{
    cout << "Name year of joining address\n";
    
     Employee e;
     e.Initialize("Robert", 1994, "64C- wallsteat");
     e.Display();
     e.Initialize("Sam", 2000, "68D- wallsteat");
     e.Display();
     e.Initialize("John", 1999, "26B- wallsteat");
     e.Display();

     return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS