From 0617d6ffa8f8528f29af021dea31b09690acf333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=20=D0=9E=D0=BB=D0=B5=D0=BA=D1=81?= =?UTF-8?q?=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Tue, 28 May 2019 00:08:48 +0300 Subject: [PATCH] Oleksenko Vladislav Platonov Denis Statistics University --- human.h | 31 ++++++++++++++ project.cpp | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++ record_book.h | 71 +++++++++++++++++++++++++++++++ student.h | 29 +++++++++++++ teacher.h | 67 +++++++++++++++++++++++++++++ worker.h | 59 ++++++++++++++++++++++++++ 6 files changed, 372 insertions(+) create mode 100644 human.h create mode 100644 project.cpp create mode 100644 record_book.h create mode 100644 student.h create mode 100644 teacher.h create mode 100644 worker.h diff --git a/human.h b/human.h new file mode 100644 index 0000000..1acce37 --- /dev/null +++ b/human.h @@ -0,0 +1,31 @@ +// human.h +#ifndef HUMAN_H_INCLUDED +#define HUMAN_H_INCLUDED + +#include +#include + +class human { + public: + // constructor human + human(std::string last_name, + std::string name) + { + this->last_name = last_name; + this->name = name; + } + + // Get full name + std::string get_full_name() + { + std::ostringstream full_name; + full_name << this->last_name; + return full_name.str(); + } + + private: + std::string name; // имя + std::string last_name; // фамилия +}; + +#endif // HUMAN_H_INCLUDED diff --git a/project.cpp b/project.cpp new file mode 100644 index 0000000..3f65ad7 --- /dev/null +++ b/project.cpp @@ -0,0 +1,115 @@ +#include +#include +#include "worker.h" +#include "student.h" +#include "teacher.h" +#include "record_book.h" +int main(int argc, char* argv[]) +{ + std::vector record_book_list; + std::vector student_list; + std::vector teacher_list; + std::vector worker_list; + std::string name, last_name, kind; + unsigned int experience, work_time,degree, basic_salary, record_book_num, number, mathematical_analysis, data_science, algebra, philosophy; + int N, num, j; + std::string mathematical_analysis_teacher, data_science_teacher, algebra_teacher, philosophy_teacher; + while (num != 8){ + std::cout <<"Select operation mode: {1-8} "<>num; + if (num == 1) + { + std::cout <<"Enter the student's last name, name, record book number"<> last_name; + std::cin>> name; + std::cin>> record_book_num; + student_list.push_back(student(last_name, name, record_book_num)); + } + else if(num == 2){ + std::cout <<"Enter the teacher's last name, name, experience, degree, work time in a week and basic salary at the university"<> last_name; + std::cin>> name; + std::cin>> experience; + std::cin>>degree; + std::cin>> work_time; + std::cin>> basic_salary; + teacher_list.push_back(teacher(last_name, name, experience,work_time,degree, basic_salary)); + } + else if (num == 3){ + std::cout <<"Enter record book: number, mathematical_analysis and teacher, data_science and teacher, algebra and teacher, philosophy and teacher: "<> number; + std::cin>> mathematical_analysis; + std::cin>> mathematical_analysis_teacher; + std::cin>> data_science; + std::cin>> data_science_teacher; + std::cin>> algebra; + std::cin>> algebra_teacher; + std::cin>> philosophy; + std::cin>> philosophy_teacher; + record_book_list.push_back(record_book(number, mathematical_analysis, mathematical_analysis_teacher, data_science, + data_science_teacher, algebra, algebra_teacher, philosophy, philosophy_teacher )); + } + else if (num == 4){ + std::string tname; + std::cout<<"Enter the teacher name "<>tname; + for (int h = 0; h>sname; + for (int h = 0; h> last_name; + std::cin>> name; + std::cin>> kind; + std::cin>> experience; + std::cin>> work_time; + std::cin>> basic_salary; + worker_list.push_back(worker(last_name, name, kind, experience,work_time, basic_salary)); + } + else if (num == 7){ + std::cout<<"Students: "< +#include + +class record_book{ + private: + unsigned int number; + unsigned int mathematical_analysis; + std::string mathematical_analysis_teacher; + unsigned int data_science; + std::string data_science_teacher; + unsigned int algebra; + std::string algebra_teacher; + unsigned int philosophy; + std::string philosophy_teacher; + public: + record_book(unsigned int number, + unsigned int mathematical_analysis, std::string mathematical_analysis_teacher, + unsigned int data_science, std::string data_science_teacher, + unsigned int algebra, std::string algebra_teacher, + unsigned int philosophy, std::string philosophy_teacher) + { + this->number = number; + this->mathematical_analysis = mathematical_analysis; + this->data_science = data_science; + this->algebra = algebra; + this->philosophy = philosophy; + this->mathematical_analysis_teacher = mathematical_analysis_teacher; + this->data_science_teacher = data_science_teacher; + this->algebra_teacher = algebra_teacher; + this->philosophy_teacher = philosophy_teacher; + } + + unsigned int get_number() + { + return this->number; + } + // Get student's average score + float get_average_score() + { + std::vector scores; + scores.push_back(this->mathematical_analysis); + scores.push_back(this->data_science); + scores.push_back(this->algebra); + scores.push_back(this->philosophy); + unsigned int sum_scores = 0; + // Average marks + float average_score; + + for (unsigned int i = 0; i < 4; ++i) { + sum_scores += scores[i]; + } + + average_score = (float) sum_scores / 4.0; + return average_score; + } + std::vector get_list_of_teachers() + { + std::vector list_of_teachers; + list_of_teachers.push_back(this->mathematical_analysis_teacher); + list_of_teachers.push_back(this->data_science_teacher); + list_of_teachers.push_back(this->algebra_teacher); + list_of_teachers.push_back(this->philosophy_teacher); + return list_of_teachers; + + } +}; +#endif // RECORD_BOOK_H_INCLUDED diff --git a/student.h b/student.h new file mode 100644 index 0000000..01c09e6 --- /dev/null +++ b/student.h @@ -0,0 +1,29 @@ +// student.h +#ifndef STUDENT_H_INCLUDED +#define STUDENT_H_INCLUDED + +#include "human.h" +#include +#include + +class student : public human { + public: + // Student constructor + student( + std::string last_name, + std::string name, + unsigned int record_book_number + ) : human( + last_name, + name + ) { + this->record_book_number = record_book_number; + } + unsigned int get_record_book_number(){ + return this->record_book_number; + } + + private: + unsigned int record_book_number; +}; +#endif // STUDENT_H_INCLUDED diff --git a/teacher.h b/teacher.h new file mode 100644 index 0000000..12b2fcc --- /dev/null +++ b/teacher.h @@ -0,0 +1,67 @@ +// teacher.h +#ifndef TEACHER_H_INCLUDED +#define TEACHER_H_INCLUDED + +#include "human.h" +#include + +class teacher : public human { + // teacher constructor + public: + teacher( + std::string last_name, + std::string name, + // Work time and work experience + unsigned int experience, + unsigned int work_time, + unsigned int degree, + unsigned int basic_salary + ) : human( + last_name, + name) + { + this->work_time = work_time; + this->experience = experience; + this->degree = degree; + this->basic_salary = basic_salary; + } + + // Gettimg work time + unsigned int get_work_time() + { + return this->work_time; + } + + // Gettimg an experience + unsigned int get_experience() + { + return this->experience; + } + + // Gettimg an degree + unsigned int get_degree() + { + return this->degree; + } + + // Gettimg a basic salary + unsigned int get_basic_salary() + { + return this->basic_salary; + } + + float get_salary() + { + float salary = ((float) this->basic_salary * (2 - ((float) this ->degree * 0.1)) + + ((float) this->basic_salary * (float)this ->experience * 0.1)) * (((float)this -> work_time)/40); + return salary; + } + private: + // Work time, experience, degree + unsigned int work_time; + unsigned int experience; + unsigned int degree; + unsigned int basic_salary; +}; + +#endif // TEACHER_H_INCLUDED diff --git a/worker.h b/worker.h new file mode 100644 index 0000000..abeb751 --- /dev/null +++ b/worker.h @@ -0,0 +1,59 @@ +// worker.h +#ifndef WORKER_H_INCLUDED +#define WORKER_H_INCLUDED + +#include "human.h" + +class worker : public human { + // worker constructor +public: + worker( + std::string last_name, + std::string name, + std::string kind_of_prof, + // Work time and work experience + unsigned int experience, + unsigned int work_time, + unsigned int basic_salary + ) : human( + last_name, + name) + { + this->work_time = work_time; + this->experience = experience; + this->basic_salary = basic_salary; + } + + // Gettimg work time + unsigned int get_work_time() + { + return this->work_time; + } + + // Gettimg an experience + unsigned int get_experience() + { + return this->experience; + } + + + // Gettimg a basic salary + unsigned int get_basic_salary() + { + return this->basic_salary; + } + + float get_salary() + { + float salary = ((float) this->basic_salary * (2 - ((float) this ->degree * 0.1)) + + ((float) this->basic_salary * (float)this ->experience * 0.1)) * (((float)this -> work_time)/40); + return salary; + } +private: + // Work time, experience, degree + unsigned int work_time; + unsigned int experience; + unsigned int degree; + unsigned int basic_salary; +}; +#endif