// ver 5.cpp: определяет точку входа для консольного приложения.
#include "stdafx.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Professor.h"
#include "Project.h"
#include "Student.h"
#include "University.h"
#include"conio.h"
#include"iostream"
#include"string"
#include <map>
#include <iostream>
#include <vector>
using namespace std;
#define _Line cout << "________________________________________________________________________________________________________" << "\n\n"
#define Tab_Line cout << "========================================================================================================" << "\n"
int main()
{
Tab_Line;
cout << " Version 5 by ???" << endl;
Project pro("First Project", "own", 12, 14);
Project pro1 = pro;
cout << "\nWorking with 'Project'" << endl;
cout << "Operators << and >>\n";
cin >> pro; //Перевантажений оператор виводу
cout << pro; //Перевантажений оператор вводу
pro = pro1;//перевантження оператора присвоєння
cout << "Operators =\n Project " << pro1;
_Line;
pro1++; //Перевантажений оператор префіксного інкременту
cout << "Operators ()++\n (term of execution + 1)" << pro1;
_Line;
++pro1; //Перевантажений оператор постфіксного інкременту
cout << "Operators ++()\n" << pro1;
_Line;
cout << "Operators +\n Enter number you want to add to number of worker";
int l;
cin >> l;
pro1 = pro1 + l;//Перевантажений оператор суми
cout << endl << pro1;
cout << endl << pro;
pro1.add_company();
pro1.add_ministry();
pro1.add_university();
system("pause"); //опис завдання
cin.get();
}
* Module: Project.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;
#define _Line cout << "________________________________________________________________________________________________________" << "\n"
#define Tab_Line cout << "========================================================================================================" << "\n"
Project& Project::operator ++()//Перевантаження унарного оператора постфіксного інкременту
{
term_of_execution += 1;
return *this;
}
Project Project::operator ++(int)//Перевантаження унарного оператора префіксного інкременту
{
Project project = *this;
++*this;
return project;
}
Project Project::operator +(int i)//перевантаження бінарного оператора
{
number_of_worker += i;
return *this;
}
Project Project::operator =(Project pro)//перевантження оператора присвоєння
{
string name, phone;
pro.getInfo(&description, &term_of_execution, &number_of_worker, &name);
return Project(name, description, term_of_execution, number_of_worker);
}
ostream& operator << (std::ostream& os, const Project& pro)//Перевантажений оператор виводу
{
std::string name, description;
int term_of_execution, number_of_worker;
Project project = pro;
project.getInfo(&description, &term_of_execution, &number_of_worker, &name);
os << name << " " << description << " " << term_of_execution << " " << number_of_worker << "\n";
return os;
}
istream& operator >> (std::istream& is, Project& pro)//Перевантажений оператор вводу
{
std::string name, description;
int term_of_execution, number_of_worker;
cout << "Enter name: ";
is >> name;
cout << "Enter description: ";
is >> description;
cout << "Enter term of execution(int): ";
is >> term_of_execution;
cout << "Enter number of worker(int): ";
is >> number_of_worker;
pro.setInfo(description, term_of_execution, number_of_worker, name);
return is;
}
void Project::getInfo(std::string* description, int* term_of_execution, int* number_of_worker, std::string* name)
{
*name = this->name;
*description = this->description;
*term_of_execution = this->term_of_execution;
*number_of_worker = this->number_of_worker;
// *name = this->name;
}
void Project::setInfo(std::string description, int term_of_execution, int number_of_worker, std::string name)
{
this->name = name;
this->description = description;
this->term_of_execution = term_of_execution;
this->number_of_worker = number_of_worker;
// this->name = name;
}
void Project::SetName(std::string k)
{
name = k;
}
void Project::SetDescription(std::string l)
{
description = l;
}
void Project::SetTermOfExecution(int o)
{
term_of_execution = o;
}
void Project::SetNumberOfWorker(int t)
{
number_of_worker = t;
}
void Project::add_ministry(void)
{
Tab_Line;
Ministry ministry1; //конструктор за замовчуванням
cout << "Working with 'Ministry'" << endl;
cin >> ministry1;
cout << "Operators << and >>\n" << ministry1;
}
void Project::add_company(void)
{
Tab_Line;
Company comp("First Company", 10, "Kyiv", "Programming");
Company comp1 = comp;
cout << "\nWorking with 'Company'" << endl;
cout << "Operators << and >>\n";
cin >> comp; //Перевантажений оператор виводу
cout << comp; //Перевантажений оператор вводу
comp = comp1;//перевантження оператора присвоєння
_Line;
cout << "Operators =\n Company " << comp1;
_Line;
comp1++; //Перевантажений оператор префіксного інкременту
cout << "Operators ()++\n (number of employees + 1)" << comp1;
_Line;
++comp1; //Перевантажений оператор постфіксного інкременту
cout << "Operators ++()\n" << comp1;
_Line;
cout << "Operators +\n Enter number you want to add to number of employees";
int c;
cin >> c;
comp1 = comp1 + c;//Перевантажений оператор суми
cout << endl << comp1;
cout << endl << comp;
_Line;
comp1.add_employee(); //залучити працівника
}
void Project::add_university(void)
{
Tab_Line;
University univ("First University", 10, 12, 14);
University univ1 = univ;
cout << "\nWorking with 'University'" << endl;
cout << "Operators << and >>\n";
cin >> univ; //Перевантажений оператор виводу
cout << univ; //Перевантажений оператор вводу
univ = univ1;//перевантження оператора присвоєння
_Line;
cout << "Operators =\n University " << univ1;
_Line;
univ1++; //Перевантажений оператор префіксного інкременту
cout << "Operators ()++\n (number of students + 1)" << univ1;
_Line;
++univ1; //Перевантажений оператор постфіксного інкременту
cout << "Operators ++()\n" << univ1;
_Line;
cout << "Operators +\n Enter number you want to add to number of faculties";
int k;
cin >> k;
univ1 = univ1 + k;//Перевантажений оператор суми
cout << endl << univ1;
cout << endl << univ;
univ1.add_student();
univ1.add_professor();
}
void Project::start(void)
{
// TODO : implement
}
* Module: Project.h
#if !defined(__ClassDiagram_Project_h)
#define __ClassDiagram_Project_h
#include "stdafx.h"
#include "Company.h"
#include "University.h"
#include "Ministry.h"
#include<string>
#include<iostream>
#include <vector>
using namespace std;
class Company;
class University;
class Ministry;
class Project
{
protected:
private:
Company m_company;
University m_university;
Ministry m_ministry;
std::string name;
std::string description;
int term_of_execution;
int number_of_worker;
public:
Project() :m_company(), m_university(), m_ministry(), name(""), description(""), term_of_execution(1), number_of_worker(1){};// конструктор за замовченням
Project(string n, string d, int t, int numb) :m_company("", 1, "", ""), m_university("", 1, 1, 1), m_ministry("", 1, 1), name(n), description(d), term_of_execution(t), number_of_worker(numb){};// конструктор ініціалізації
~Project(){};// деструктор
void getInfo(std::string* description, int* term_of_execution, int* number_of_worker, std::string* name);
void setInfo(std::string description, int term_of_execution, int number_of_worker, std::string name);
void start(void);
void add_company(void);
void add_ministry(void);
void add_university(void);
void SetName(std::string );
void SetDescription(std::string );
void SetTermOfExecution(int );
void SetNumberOfWorker(int );
string Project::GetName() const
{
return this->name;
}
string Project::GetDescription() const
{
return this->description;
}
inline int Project::GetTermOfExecution()
{
return this->term_of_execution;
}
inline int Project::GetNumberOfWorker()
{
return this->number_of_worker;
}
Project& Project::operator ++();///Перевантажений оператор постфіксного інкременту
Project Project::operator ++(int);///Перевантажений оператор префіксного інкременту
Project Project::operator +(int i);///Перевантажений оператор суми
Project Project::operator =(Project pro);//перевантження оператора присвоєння
friend std::ostream& operator << (std::ostream& os, const Project& pro);//Перевантажений оператор виводу
friend std::istream& operator >> (std::istream& is, Project& pro);//Перевантажений оператор вводу
/*Company** company;
University** university;
Ministry* ministry;
*/
};
#endif
* Module: Company.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;
#define _Line cout << "________________________________________________________________________________________________________" << "\n\n"
#define Tab_Line cout << "========================================================================================================" << "\n"
Company& Company::operator ++()//Перевантаження унарного оператора постфіксного інкременту
{
number_of_employees += 1;
return *this;
}
Company Company::operator ++(int)//Перевантаження унарного оператора префіксного інкременту
{
Company company = *this;
++*this;
return company;
}
Company Company::operator +(int i)//перевантаження бінарного оператора
{
number_of_employees += i;
return *this;
}
Company Company::operator =(Company comp)//перевантження оператора присвоєння
{
string name, phone;
comp.getInfo(&number_of_employees, &location, &type_of_employment, &name);
return Company( name, number_of_employees, location, type_of_employment);
}
ostream& operator << (std::ostream& os, const Company& comp)//Перевантажений оператор виводу
{
std::string name, location, type_of_employment;
int number_of_employees;
Company company = comp;
company.getInfo(&number_of_employees, &location, &type_of_employment, &name);
os << name << " " << number_of_employees << " " << location << " " << type_of_employment << "\n";
return os;
}
istream& operator >> (std::istream& is, Company& comp)//Перевантажений оператор вводу
{
std::string name, location, type_of_employment;
int number_of_employees;
cout << "Enter name: ";
is >> name;
cout << "Enter number of employees(int): ";
is >> number_of_employees;
cout << "Enter location: ";
is >> location;
cout << "Enter type of employment: ";
is >> type_of_employment;
comp.setInfo(number_of_employees, location, type_of_employment, name);
return is;
}
void Company::getInfo(int* number_of_employees, std::string* location, std::string* type_of_employment, std::string* name)
{
*name = this->name;
*number_of_employees = this->number_of_employees;
*location = this->location;
*type_of_employment = this->type_of_employment;
*name = this->name;
}
void Company::setInfo(int number_of_employees, std::string location, std::string type_of_employment, std::string name)
{
this->name = name;
this->number_of_employees = number_of_employees;
this->location = location;
this->type_of_employment = type_of_employment;
this->name = name;
}
void Company::SetName(std::string k)
{
name = k;
}
void Company::SetNumberOfEmployee(int m)
{
number_of_employees = m;
}
void Company::SetLocation(std::string f)
{
location = f;
}
void Company::SetTypeOfEmployment(std::string e)
{
type_of_employment = e;
}
void Company::add_employee(void)
{
cout << endl << "creating 'Employee':\n" << endl;
_Line;
std::string name;
int age;
std::string work;
int salary;
cout << "Input name of employee: ";
cin >> name ; m_employee.SetName(name);
cout << "Input age of employee(int): ";
cin >> age; m_employee.SetAge(age);
cout << "Input work of employee: ";
cin >> work; m_employee.SetWork(work);
cout << "Input salary of employee(int): ";
cin >> salary; m_employee.SetSalary(salary);
cout << endl;
_Line;
cout << "Employee created:" << endl;
cout << "Employee\nName: " << m_employee.GetName() << endl << "Age: " << m_employee.GetAge() << endl << "Work: " << m_employee.GetWork() << endl << "Salary: " << m_employee.GetSalary() << endl;
cout << endl;
Tab_Line;
}
void Company::create_your_own_divisions(void)
{
// TODO : implement
}
void Company::fund_university(void)
{
// TODO : implement
}
void Company::give_projects(void)
{
// TODO : implement
}
* Module: Company.h
#if !defined(__ClassDiagram_Company_h)
#define __ClassDiagram_Company_h
#include "stdafx.h"
#include "Employee.h"
#include<string>
#include<iostream>
#include<vector>
using namespace std;
class Employee;
class Company
{
protected:
private:
Employee m_employee;
std::string name;
int number_of_employees;
std::string location;
std::string type_of_employment;
public:
Company() : m_employee(), name(""), number_of_employees(1), location(""), type_of_employment(""){}; // конструктор за замовченням
Company(std::string n, int numb, std::string l, std::string t) :m_employee("dd", 1, "ff", 1), name(n), number_of_employees(numb), location(l), type_of_employment(t){};// конструктор ініціалізації
~Company() {}; // деструктор
void getInfo(int* number_of_employees, std::string* location, std::string* type_of_employment, std::string* name);///<Гетер для атрибутів компанії
void setInfo(int number_of_employees, std::string location, std::string type_of_employment, std::string name);//сетер для атрибутів компанії
void add_employee(void);
void create_your_own_divisions(void);
void fund_university(void);
void give_projects(void);
void SetName(std::string); // встановити ім'я
void SetNumberOfEmployee(int); // встановити кількість працівників
void SetTypeOfEmployment(std::string);
void SetLocation(std::string);
string Company::GetName() const
{
return this->name;
}
inline int Company::GetNumberOfEmployee()
{
return this->number_of_employees;
}
string Company::GetLocation() const
{
return this->location;
}
inline string Company::GetTypeOfEmployment()
{
return this->type_of_employment;
}
Company& Company::operator ++();///Перевантажений оператор постфіксного інкременту
Company Company::operator ++(int);///Перевантажений оператор префіксного інкременту
Company Company::operator +(int i);///Перевантажений оператор суми
Company Company::operator =(Company comp);//перевантження оператора присвоєння
friend std::ostream& operator << (std::ostream& os, const Company& comp);//Перевантажений оператор виводу
friend std::istream& operator >> (std::istream& is, Company& comp);//Перевантажений оператор вводу
// Employee** employee;
};
#endif
* Module: Employee.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;
void Employee::SetName(std::string k)
{
name = k;
}
void Employee::SetAge(int f)
{
age = f;
}
void Employee::SetWork(std::string e)
{
work = e;
}
void Employee::SetSalary(int p)
{
salary = p;
}
void Employee::give_project(void)
{
// TODO : implement
}
void Employee::provide_resources(void)
{
// TODO : implement
}
void Employee::keeps_track_implementation(void)
{
// TODO : implement
}
void Employee::takes_job(void)
{
// TODO : implement
}
* Module: Employee.h
#if !defined(__ClassDiagram_Employee_h)
#define __ClassDiagram_Employee_h
#include "stdafx.h"
#include<string>
#include<iostream>
using namespace std;
class Employee
{
protected:
private:
std::string name;
int age;
std::string work;
int salary;
public:
Employee() :name(""), age(1), work(""), salary(1){}; // конструктор за замовченням
Employee(std::string n, int a, std::string w, int s) :name(n), age(a), work(w), salary(s){}; // конструктор ініціалізації
~Employee(){}; // деструктор
void give_project(void);
void provide_resources(void);
void keeps_track_implementation(void);
void takes_job(void);
void SetName(std::string);
void SetAge(int);
void SetWork(std::string);
void SetSalary(int);
string Employee::GetName() const
{
return this->name;
}
int Employee::GetAge() const
{
return this->age;
}
inline string Employee::GetWork()
{
return this->work;
}
inline int Employee::GetSalary()
{
return this->salary;
}
};
#endif
* Module: Ministry.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;
ostream& operator << (std::ostream& os, const Ministry& minis)//Перевантажений оператор виводу
{
std::string name;
int number_of_employee, budget;
Ministry ministry = minis;
ministry.getInfo(&number_of_employee, &budget, &name);
os << name << " " << number_of_employee << " " << budget << "\n";
return os;
}
istream& operator >> (std::istream& is, Ministry& minis)//Перевантажений оператор вводу
{
std::string name;
int number_of_employee, budget;
cout << "Enter name: ";
is >> name;
cout << "Enter number of employees(int): ";
is >> number_of_employee;
cout << "Enter budget(int): ";
is >> budget;
minis.setInfo(number_of_employee, budget, name);
return is;
}
void Ministry::getInfo(int* number_of_employee, int* budget, std::string* name)
{
*name = this->name;
*number_of_employee = this->number_of_employee;
*budget = this->budget;
*name = this->name;
}
void Ministry::setInfo(int number_of_employee, int budget, std::string name)
{
this->name = name;
this->number_of_employee = number_of_employee;
this->budget = budget;
this->name = name;
}
void Ministry::SetName(std::string k)
{
name = k;
}
void Ministry::SetNumberOfEmployee(int m)
{
number_of_employee = m;
}
void Ministry::SetBudget(int l)
{
budget = l;
}
void Ministry::set_framework_for_university(void)
{
// TODO : implement
}
void Ministry::provide_staff(void)
{
// TODO : implement
}
void Ministry::provide_necessary_resources(void)
{
// TODO : implement
}
* Module: Ministry.h
#if !defined(__ClassDiagram_Ministry_h)
#define __ClassDiagram_Ministry_h
#include "stdafx.h"
#include<string>
#include<iostream>
using namespace std;
class Ministry
{
protected:
private:
int number_of_employee;
int budget;
std::string name;
public:
Ministry() :name(""), budget(1), number_of_employee(1){};// конструктор за замовченням
Ministry(string n, int b, int numb): name(n), budget(b), number_of_employee(numb){}; // конструктор ініціалізації
~Ministry(){}; // деструктор
void getInfo(int* number_of_employee, int* budget, std::string* name);
void setInfo(int number_of_employee, int budget, std::string name);
void set_framework_for_university(void);
void provide_staff(void);
void provide_necessary_resources(void);
void SetName(std::string); // встановити ім'я
void SetNumberOfEmployee(int); // встановити кількість працівників
void SetBudget(int); // встановити бюджет
string Ministry::GetName() const
{
return this->name;
}
inline int Ministry::GetNumberOfEmployee()
{
return this->number_of_employee;
}
inline int Ministry::GetBudget()
{
return this->budget;
}
friend std::ostream& operator << (std::ostream& os, const Ministry& minis);//Перевантажений оператор виводу
friend std::istream& operator >> (std::istream& is, Ministry& minis);//Перевантажений оператор вводу
};
#endif
* Module: Professor.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;
void Professor::SetName(std::string k)
{
name = k;
}
void Professor::SetAge(int l)
{
age = l;
}
void Professor::SetWork(std::string p)
{
work = p;
}
void Professor::SetExperience(int y)
{
experience = y;
}
void Professor::SetFaculty(std::string o)
{
faculty = o;
}
void Professor::teach_student(void)
{
// TODO : implement
}
void Professor::work_on_the_project(void)
{
// TODO : implement
}
void Professor::conduct_research(void)
{
// TODO : implement
}
* Module: Professor.h
#if !defined(__ClassDiagram_Professor_h)
#define __ClassDiagram_Professor_h
#include "stdafx.h"
#include "Professor.h"
#include<string>
#include<iostream>
using namespace std;
class Professor
{
protected:
private:
std::string name;
int age;
std::string work;
int experience;
std::string faculty;
public:
Professor() :name(""), age(1), work(""), experience(1), faculty(""){};// конструктор за замовченням
Professor(string n, int a, string w, int e, string f) :name(n), age(a), work(w), experience(e), faculty(f){};// конструктор ініціалізації
~Professor(){}; // деструктор
void teach_student(void);
void work_on_the_project(void);
void conduct_research(void);
void SetName(std::string);
void SetAge(int);
void SetWork(std::string);
void SetExperience(int);
void SetFaculty(std::string);
string Professor::GetName() const
{
return this->name;
}
int Professor::GetAge() const
{
return this->age;
}
inline string Professor::GetWork()
{
return this->work;
}
int Professor::GetExperience() const
{
return this->experience;
}
inline string Professor::GetFaculty()
{
return this->faculty;
}
};
#endif
* Module: Student.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;
void Student::SetName(std::string k)
{
name = k;
}
void Student::SetAge(int l)
{
age = l;
}
void Student::SetGroup(std::string o)
{
group = o;
}
void Student::SetCourse(int l)
{
course = l;
}
void Student::SetFaculty(std::string o)
{
faculty = o;
}
void Student::study_at_univer(void)
{
// TODO : implement
}
void Student::working_on_a_project(void)
{
// TODO : implement
}
void Student::conducts_research(void)
{
// TODO : implement
}
* Module: Student.h
#if !defined(__ClassDiagram_Student_h)
#define __ClassDiagram_Student_h
#include "stdafx.h"
#include<string>
#include<iostream>
using namespace std;
class Student
{
protected:
private:
std::string name;
int age;
std::string faculty;
int course;
std::string group;
public:
Student() :name(""), age(1), faculty(""), course(1), group(""){};// конструктор за замовченням
Student(string n, int a, string f, int c, string g) :name(n), age(a), faculty(f), course(c), group(g){};// конструктор ініціалізації
~Student(){};// деструктор
void study_at_univer(void);
void working_on_a_project(void);
void conducts_research(void);
void SetName(std::string);
void SetAge(int);
void SetGroup(std::string);
void SetCourse(int);
void SetFaculty(std::string);
string Student::GetName() const
{
return this->name;
}
int Student::GetAge() const
{
return this->age;
}
inline string Student::GetGroup()
{
return this->group;
}
inline int Student::GetCourse()
{
return this->course;
}
inline string Student::GetFaculty()
{
return this->faculty;
}
};
#endif
* Module: University.cpp
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include "University.h"
#include "Company.h"
#include "Employee.h"
#include "Ministry.h"
#include "Project.h"
#include<string>
#include<iostream>
using namespace std;
#define _Line cout << "________________________________________________________________________________________________________" << "\n\n"
#define Tab_Line cout << "========================================================================================================" << "\n"
University& University::operator ++()//Перевантаження унарного оператора постфіксного інкременту
{
number_of_students += 1;
return *this;
}
University University::operator ++(int)//Перевантаження унарного оператора префіксного інкременту
{
University university = *this;
++*this;
return university;
}
University University::operator +(int i)//перевантаження бінарного оператора
{
number_of_teachers += i;
return *this;
}
University University::operator =(University univ)//перевантження оператора присвоєння
{
string name, phone;
univ.getInfo(&number_of_students, &number_of_teachers, &number_of_faculties, &name);
return University(name, number_of_students, number_of_teachers, number_of_faculties);
}
ostream& operator << (std::ostream& os, const University& univ)//Перевантажений оператор виводу
{
std::string name;
int number_of_students, number_of_teachers, number_of_faculties;
University university = univ;
university.getInfo(&number_of_students, &number_of_students, &number_of_faculties, &name);
os << name << " " << number_of_students << " " << number_of_students << " " << number_of_faculties << "\n";
return os;
}
istream& operator >> (std::istream& is, University& univ)//Перевантажений оператор вводу
{
std::string name;
int number_of_students, number_of_teachers, number_of_faculties;
cout << "Enter name: ";
is >> name;
cout << "Enter number of students(int): ";
is >> number_of_students;
cout << "Enter number of teachers(int): ";
is >> number_of_teachers;
cout << "Enter number of faculties(int): ";
is >> number_of_faculties;
univ.setInfo(number_of_students, number_of_teachers, number_of_faculties, name);
return is;
}
void University::getInfo(int* number_of_students, int* number_of_teachers, int* number_of_faculties, std::string* name)
{
*name = this->name;
*number_of_students = this->number_of_students;
*number_of_teachers = this->number_of_teachers;
*number_of_faculties = this->number_of_faculties;
*name = this->name;
}
void University::setInfo(int number_of_students, int number_of_teachers, int number_of_faculties, std::string name)
{
this->name = name;
this->number_of_students = number_of_students;
this->number_of_teachers = number_of_teachers;
this->number_of_faculties = number_of_faculties;
this->name = name;
}
void University::SetName(std::string k)
{
name = k;
}
void University::SetNumberOfStudents(int l)
{
number_of_students = l;
}
void University::SetNumberOfTeachers(int m)
{
number_of_teachers = m;
}
void University::SetNumberOfFaculties(int p)
{
number_of_faculties = p;
}
void University::add_student(void)
{
cout << endl << "creating 'Student':\n" << endl;
_Line;
std::string name;
int age;
std::string faculty;
int course;
std::string group;
cout << "Input name of student: ";
cin >> name; m_student.SetName(name);
cout << "Input age of student(int): ";
cin >> age; m_student.SetAge(age);
cout << "Input faculty of student: ";
cin >> faculty; m_student.SetFaculty(faculty);
cout << "Input course of student(int): ";
cin >> course; m_student.SetCourse(course);
cout << "Input group of student: ";
cin >> group; m_student.SetGroup(group);
cout << endl;
_Line;
cout << "Student created:" << endl;
cout << "Student\nName: " << m_student.GetName() << "\nStudent's age:" << m_student.GetAge() << "\nStudent's faculty:" << m_student.GetFaculty() << "\nStudent's course:" << m_student.GetCourse() << "\nStudent's group:" << m_student.GetGroup() << endl;
cout << endl;
Tab_Line;
}
void University::add_professor(void)
{
cout << endl << "creating 'Professor':\n" << endl;
_Line;
std::string name;
int age;
std::string work;
int experience;
std::string faculty;
cout << "Input name of professor: ";
cin >> name; m_professor.SetName(name);
cout << "Input age of professor(int): ";
cin >> age; m_professor.SetAge(age);
cout << "Input work of professor: ";
cin >> work; m_professor.SetWork(work);
cout << "Input experience of professor(int): ";
cin >> experience; m_professor.SetExperience(experience);
cout << "Input faculty of professor: ";
cin >> faculty; m_professor.SetFaculty(faculty);
cout << endl;
_Line;
cout << "Professor created:" << endl;
cout << "Professor\nName: " << m_professor.GetName() << endl << "Age: " << m_professor.GetAge() << endl << "Work: " << m_professor.GetWork() << endl << "Experience: " << m_professor.GetExperience() << endl << "Faculty: " << m_professor.GetFaculty() << endl;
cout << endl;
Tab_Line;
}
void University::implement_projects(void)
{
// TODO : implement
}
void University::create_special_departments(void)
{
// TODO : implement
}
void University::create_conditions_for_project_implementation(void)
{
// TODO : implement
}
void University::generate_new_technology(void)
{
// TODO : implement
}
* Module: University.h
#if !defined(__ClassDiagram_University_h)
#define __ClassDiagram_University_h
#include "stdafx.h"
#include "Student.h"
#include "Professor.h"
#include<string>
#include<iostream>
#include<vector>
using namespace std;
class Student;
class Professor;
class University
{
protected:
private:
Student m_student;
Professor m_professor;
std::string name;
int number_of_students;
int number_of_teachers;
int number_of_faculties;
public:
University() :m_student(), m_professor(), name(""), number_of_students(1), number_of_teachers(1), number_of_faculties(1){};// конструктор за замовченням
University(string n, int ns, int nt, int nf) :m_student("ss", 1, "", 1, ""), m_professor("ss", 1, "", 1, ""), name(n), number_of_students(ns), number_of_teachers(nt), number_of_faculties(nf){};// конструктор ініціалізації
~University(){}; // деструктор
void getInfo(int* number_of_students, int* number_of_teachers, int* number_of_faculties, std::string* name);///<Гетер для атрибутів компанії
void setInfo(int number_of_students, int number_of_teachers, int number_of_faculties, std::string name);//сетер для атрибутів компанії
void implement_projects(void);
void add_student(void);
void add_professor(void);
void create_special_departments(void);
void create_conditions_for_project_implementation(void);
void generate_new_technology(void);
void SetName(std::string );
void SetNumberOfStudents(int );
void SetNumberOfTeachers(int );
void SetNumberOfFaculties(int );
string University::GetName() const
{
return this->name;
}
int University::GetNumberOfStudents() const
{
return this->number_of_students;
}
int University::GetNumberOfTeachers() const
{
return this->number_of_teachers;
}
inline int University::GetNumberOfFaculties()
{
return this->number_of_faculties;
}
University& University::operator ++();///Перевантажений оператор постфіксного інкременту
University University::operator ++(int);///Перевантажений оператор префіксного інкременту
University University::operator +(int i);///Перевантажений оператор суми
University University::operator =(University univ);//перевантження оператора присвоєння
friend std::ostream& operator << (std::ostream& os, const University& univ);//Перевантажений оператор виводу
friend std::istream& operator >> (std::istream& is, University& univ);//Перевантажений оператор вводу
/* Student** student;
Professor** professor;
*/
};
#endif
|