![C-C++-Programming](https://connectkreations.com/wp-content/uploads/2023/02/C-C-Programming.jpg)
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](https://connectkreations.com/wp-content/uploads/2023/02/C-C-Programming.jpg)
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:
- Start by creating the
Manager
class with the constructor method that takes the following parameters:name
,age
,employee_id
, anddepartment
. - Inside the
Manager
class, create instance variables for each of the parameters passed to the constructor method. - Create a new class called
ProductionManager
that inherits from theManager
class. - In the
ProductionManager
class, add an additional instance variable calledsupervisors
. - In the
ProductionManager
class, create a constructor method that takes the same parameters as theManager
class, plus the additional parametersupervisors
. - In the constructor method of the
ProductionManager
class, call the constructor method of theManager
class using thesuper
function and pass the parametersname
,age
,employee_id
, anddepartment
. Then, assign the value of thesupervisors
parameter to thesupervisors
instance variable. - Create a new class called
SalesManager
that inherits from theManager
class. - In the
SalesManager
class, add an additional instance variable calledsales_region
. - In the
SalesManager
class, create a constructor method that takes the same parameters as theManager
class, plus the additional parametersales_region
. - In the constructor method of the
SalesManager
class, call the constructor method of theManager
class using thesuper
function and pass the parametersname
,age
,employee_id
, anddepartment
. Then, assign the value of thesales_region
parameter to thesales_region
instance variable. - In the main program, create objects of both the
ProductionManager
andSalesManager
classes and pass values to their constructor methods. - Access the attributes of each object and display their values.
- End the program.
Algorithm in C++
Here’s an algorithm for creating the Manager, ProductionManager, and SalesManager classes in C++:
- Start by creating the
Manager
class with the constructor method that takes the following parameters:name
,age
,employee_id
, anddepartment
. - Inside the
Manager
class, create private instance variables for each of the parameters passed to the constructor method. - Create public getter and setter methods for each instance variable in the
Manager
class. - Create a new class called
ProductionManager
that inherits from theManager
class. - In the
ProductionManager
class, add an additional instance variable calledsupervisors
. - In the
ProductionManager
class, create a constructor method that takes the same parameters as theManager
class, plus the additional parametersupervisors
. - In the constructor method of the
ProductionManager
class, call the constructor method of theManager
class using the:
operator and pass the parametersname
,age
,employee_id
, anddepartment
. Then, assign the value of thesupervisors
parameter to thesupervisors
instance variable. - Create a new class called
SalesManager
that inherits from theManager
class. - In the
SalesManager
class, add an additional instance variable calledsales_region
. - In the
SalesManager
class, create a constructor method that takes the same parameters as theManager
class, plus the additional parametersales_region
. - In the constructor method of the
SalesManager
class, call the constructor method of theManager
class using the:
operator and pass the parametersname
,age
,employee_id
, anddepartment
. Then, assign the value of thesales_region
parameter to thesales_region
instance variable. - In the main program, create objects of both the
ProductionManager
andSalesManager
classes and pass values to their constructor methods. - Access the attributes of each object and display their values using the getter methods.
- 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
- Text Analysis of Wikipedia Page – “Apple” using PythonText Analysis of Wikipedia Page – “Apple” 1. Introduction 1.1 Project Overview This project aims to perform a comprehensive text… Read more: Text Analysis of Wikipedia Page – “Apple” using Python
- Digital Communication Projects using MatlabDigital Communication Projects using Matlab. 1. Multiple Input Multiple Output(MIMO) using Matlab Output 2. Pulse Width Modulation(PWM) working Principal using… Read more: Digital Communication Projects using Matlab
- Write and execute a C++ program to implement the complex number classProblem Statement Write and execute a C++ program to implement the complex number class. Algorithm Here’s an algorithm for a… Read more: Write and execute a C++ program to implement the complex number class
- C++ and Python Program for Staff Management in Organization/CompanyYou need to create a base class called Manager and include all the general data members like name, age, employee… Read more: C++ and Python Program for Staff Management in Organization/Company
- C program that implements a simple banking systemIntroduction This program implements a basic banking system with a balance variable that keeps track of the current balance. The… Read more: C program that implements a simple banking system
Join us for Regular Updates
Telegram | Join Now |
Join Now | |
Join Now | |
Join Now | |
Join Now | |
Join our Telegram | connectkreations |
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..🤓
- Our Websites: Connect Kreations
- Our Websites: StudentsDev Connect Kreations