C++ and Python Program for Staff Management in Organization/Company
Share Now...

You need to create a base class called Manager and include all the general data members like name, age, employee id, department etc.. C++ and Python Program for Staff Management in Organization/Company

C-C++-Programming

Problem Statement:

You need to create a base class called Manager and include all the general data members like name, age, employee id, department etc.

     Then you need to create a more specialized class called Production Manager which is derived from the Manager class. It must include the special features of the Production manager like no of supervisors under him etc.

     Similarly, you need to create the specialized class called Sales Manager and include its specialized members. Instantiate the objects of both the derived classes in the main().

In this example, the Manager class acts as a base class and defines the common attributes of all managers such as name, age, employee_id, and department. The ProductionManager and SalesManager classes inherit from the Manager class and add additional attributes specific to their role. Finally, the main function creates objects of both the derived classes and displays their attributes.

Algorithm in Python

Here’s an algorithm for creating the Manager, ProductionManager, and SalesManager classes in Python:

  1. Start by creating the Manager class with the constructor method that takes the following parameters: name, age, employee_id, and department.
  2. Inside the Manager class, create instance variables for each of the parameters passed to the constructor method.
  3. Create a new class called ProductionManager that inherits from the Manager class.
  4. In the ProductionManager class, add an additional instance variable called supervisors.
  5. In the ProductionManager class, create a constructor method that takes the same parameters as the Manager class, plus the additional parameter supervisors.
  6. In the constructor method of the ProductionManager class, call the constructor method of the Manager class using the super function and pass the parameters name, age, employee_id, and department. Then, assign the value of the supervisors parameter to the supervisors instance variable.
  7. Create a new class called SalesManager that inherits from the Manager class.
  8. In the SalesManager class, add an additional instance variable called sales_region.
  9. In the SalesManager class, create a constructor method that takes the same parameters as the Manager class, plus the additional parameter sales_region.
  10. In the constructor method of the SalesManager class, call the constructor method of the Manager class using the super function and pass the parameters name, age, employee_id, and department. Then, assign the value of the sales_region parameter to the sales_region instance variable.
  11. In the main program, create objects of both the ProductionManager and SalesManager classes and pass values to their constructor methods.
  12. Access the attributes of each object and display their values.
  13. End the program.

Algorithm in C++

Here’s an algorithm for creating the Manager, ProductionManager, and SalesManager classes in C++:

  1. Start by creating the Manager class with the constructor method that takes the following parameters: name, age, employee_id, and department.
  2. Inside the Manager class, create private instance variables for each of the parameters passed to the constructor method.
  3. Create public getter and setter methods for each instance variable in the Manager class.
  4. Create a new class called ProductionManager that inherits from the Manager class.
  5. In the ProductionManager class, add an additional instance variable called supervisors.
  6. In the ProductionManager class, create a constructor method that takes the same parameters as the Manager class, plus the additional parameter supervisors.
  7. In the constructor method of the ProductionManager class, call the constructor method of the Manager class using the : operator and pass the parameters name, age, employee_id, and department. Then, assign the value of the supervisors parameter to the supervisors instance variable.
  8. Create a new class called SalesManager that inherits from the Manager class.
  9. In the SalesManager class, add an additional instance variable called sales_region.
  10. In the SalesManager class, create a constructor method that takes the same parameters as the Manager class, plus the additional parameter sales_region.
  11. In the constructor method of the SalesManager class, call the constructor method of the Manager class using the : operator and pass the parameters name, age, employee_id, and department. Then, assign the value of the sales_region parameter to the sales_region instance variable.
  12. In the main program, create objects of both the ProductionManager and SalesManager classes and pass values to their constructor methods.
  13. Access the attributes of each object and display their values using the getter methods.
  14. End the program.

Implementation in C++

#include <iostream>

 

using namespace std;

 

class Manager {

   public:

    string name;

    unsigned int age;

    unsigned int employeeID;

    string department;

};

 

class ProductionManager : public Manager {

   public:

    unsigned int numSupervisors;

};

 

class SalesManager : public Manager {

   public:

    unsigned int numSales;

    unsigned int numTeamSize;

};

 

int main() {

    // Normal Manager

    Manager normie;

    normie.age = 51;

    normie.department = "Free Space";

    normie.employeeID = 42;

    normie.name = "Elum Nosk";

 

    // A Production Manager Sample

    ProductionManager productionNormie;

    productionNormie.age = 47;

    productionNormie.department = "iPhunes";

    productionNormie.employeeID = 55;

    productionNormie.name = "Catalina Julie";

    productionNormie.numSupervisors = 11;

 

    // A Sales Manager sample

    SalesManager salesNormie;

    salesNormie.age = 46;

    salesNormie.department = "Fast Fud";

    salesNormie.employeeID = 694;

    salesNormie.name = "Buren Waffet";

    salesNormie.numSales = 620;

    salesNormie.numTeamSize = 94;

 

    cout << "\n\n\n";

 

    // Print details of manager

    cout << "Manager details are as follows:\n"

         << "\nName:\t\t"

         << normie.name

         << "\nEmployee ID:\t"

         << normie.employeeID

         << "\nDepartment:\t"

         << normie.department

         << "\nAge:\t\t"

         << normie.age

         << "\n\n";

 

    // Print details of production manager

    cout << "Production Manager details are as follows:\n"

         << "\nName:\t\t"

         << productionNormie.name

         << "\nEmployee ID:\t"

         << productionNormie.employeeID

         << "\nDepartment:\t"

         << productionNormie.department

         << "\nAge:\t\t"

         << productionNormie.age

         << "\nNumber of supervisors working with:\t"

         << productionNormie.numSupervisors

         << "\n\n";

 

    // Print details of sales manager

    cout << "Sales Manager details are as follows:\n"

         << "\nName:\t\t"

         << salesNormie.name

         << "\nEmployee ID:\t"

         << salesNormie.employeeID

         << "\nDepartment:\t"

         << salesNormie.department

         << "\nAge:\t\t"

         << salesNormie.age

         << "\nTotal Sales:\t"

         << salesNormie.numSales

         << "\nTeam Size:\t"

         << salesNormie.numTeamSize

         << "\n\n\n";

 

    return 9;

}

Implementation in Python

class Manager:
    def __init__(self, name, age, employee_id, department):
        self.name = name
        self.age = age
        self.employee_id = employee_id
        self.department = department

class ProductionManager(Manager):
    def __init__(self, name, age, employee_id, department, supervisors):
        Manager.__init__(self, name, age, employee_id, department)
        self.supervisors = supervisors

class SalesManager(Manager):
    def __init__(self, name, age, employee_id, department, sales_region):
        Manager.__init__(self, name, age, employee_id, department)
        self.sales_region = sales_region

def main():
    # Creating ProductionManager object
    production_manager = ProductionManager("John Doe", 35, 12345, "Production", 10)
    print("Production Manager:")
    print("Name:", production_manager.name)
    print("Age:", production_manager.age)
    print("Employee ID:", production_manager.employee_id)
    print("Department:", production_manager.department)
    print("No of Supervisors:", production_manager.supervisors)
    print()

    # Creating SalesManager object
    sales_manager = SalesManager("Jane Doe", 40, 54321, "Sales", "North America")
    print("Sales Manager:")
    print("Name:", sales_manager.name)
    print("Age:", sales_manager.age)
    print("Employee ID:", sales_manager.employee_id)
    print("Department:", sales_manager.department)
    print("Sales Region:", sales_manager.sales_region)

if __name__ == "__main__":
    main()

Explore More Projects on Matlab

Join us for Regular Updates

TelegramJoin Now
WhatsAppJoin Now
FacebookJoin Now
InstagramJoin Now
LinkedInJoin Now
Join our Telegramconnectkreations

About Connect Kreations

We the team Connect Kreations have started a Blog page which is eminently beneficial to all the students those who are seeking jobs and are eager to develop themselves in a related area. As the world is quick on uptake, our website also focuses on latest trends in recent technologies and project learning and solutions. We are continuously putting our efforts to provide you with accurate, best quality, and genuine information. Here we also have complete set of details on how to prepare aptitude, interview and more of such placement/ off campus placement preparation.

Connect Kreations is excited to announce the expansion of our services into the realm of content creation! We are now offering a wide range of creative writing services, including poetry, articles, and stories.

Whether you need a heartfelt poem for a special occasion, a thought-provoking article for your blog or website, or an engaging story to captivate your audience, our team of talented writers is here to help. We have a passion for language and a commitment to creating high-quality content that is both original and engaging.

Our services are perfect for individuals, businesses, and organizations looking to add a touch of creativity and personality to their content. We are confident that our unique perspectives and diverse backgrounds will bring a fresh and exciting voice to your project.

Thank you for choosing Connect Kreations for your content creation needs. We look forward to working with you and helping you to bring your vision to life!

The website is open to all and we want all of you to make the best use of this opportunity and get benefit from it..🤓

Share Now...
Connect Kreations
Connect Kreations
Articles: 53