Help me develop a system that can track employee information for Googe and Micro
ID: 3887973 • Letter: H
Question
Help me develop a system that can track employee information for Googe and Microsoft.The Employee information will consist of Name, Job Title, Birthday. and Organization they work for.
For the Organization that the Employee works for, you also need to track the Organization Name and Number of Emoloyees.
The system must be able to properly compare any two employees against each other to determine if they are the same Person. This means that if you compared two People with the same Name, Birthday, and Organization, the system should think that they are equal to one another. If any of these properties are different, then the two People are not the same Person.
The same rules apply to comparing Organizations to one another. Organizations with the same Organization name are to be thought of as equal, different names means different organizations.
Please use public class Employee
Thank you
Explanation / Answer
#include<iostream>
#include<string>
using namespace std;
class Employee{
private:
string name;
string title;
string birthday;
string organization;
public:
Employee(string a, string b, string c, string d){
name = a;
title = b;
birthday = c;
organization = d;
}
string getName(){
return name;
}
string getTitle(){
return title;
}
string getBirthday(){
return birthday;
}
string getOrganization(){
return organization;
}
bool equals(Employee a){
if (name == a.getName() && title == a.getTitle() && birthday == a.getBirthday() && organization == a.getOrganization())
return true;
else
return false;
}
};
class Organization{
private:
string name;
int numberOfEmployees;
public:
Organization(string a, int n){
name = a;
numberOfEmployees = n;
}
string getName(){
return name;
}
int getNumberOfEmployees(){
return numberOfEmployees;
}
bool equals(Organization a){
if (name == a.getName() && numberOfEmployees == a.getNumberOfEmployees())
return true;
else
return false;
}
};
int main(){
Employee e1("John","Manager", "23 January 1945", "Microsoft");
Employee e2("John","Manager", "23 January 1945", "Google");
Organization o1("Microsoft",500);
Organization o2("Google", 200);
if (e1.equals(e2))
cout << "Equal" << endl;
else
cout << "Not equal" << endl;
if (o1.equals(o2))
cout << "Equal" << endl;
else
cout << "Not Equal" << endl;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.