Skip to content

Commit a4abbe7

Browse files
committed
University
University task in C++
1 parent 3c913cc commit a4abbe7

25 files changed

+589
-0
lines changed

Univeristy Task/Bank.h

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#pragma once
2+
class Bank{
3+
string _name;
4+
string _location;
5+
string _popularity;
6+
vector<BankCard>_bankcards;
7+
public:
8+
Bank() = default;
9+
Bank(string name,string location,string popularity){
10+
_name=name;
11+
_location=location;
12+
_popularity=popularity;
13+
}
14+
string getName() { return _name; }
15+
string getLocation() { return _location; }
16+
string getPopularity() { return _popularity; }
17+
vector<BankCard>& getBankcards() { return _bankcards; }
18+
19+
};

Univeristy Task/BankCard.h

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#pragma once
2+
class BankCard {
3+
string long_code;
4+
short password;
5+
float balance;
6+
short expired_month;
7+
short expired_year;
8+
9+
public:
10+
BankCard() = default;
11+
BankCard(string Long_code,short Password, float Balance, short Expired_month, short Expired_year){
12+
long_code = Long_code;
13+
password = Password;
14+
balance = Balance;
15+
expired_month = Expired_month;
16+
expired_year = Expired_year;
17+
}
18+
string getCardLongcode() { return long_code; }
19+
short getPassword() { return password; }
20+
float getBalance() { return balance; }
21+
short getExpiredMonth() { return expired_month; }
22+
short getExpiredYear() { return expired_year; }
23+
friend ostream& operator<<(ostream& output, const BankCard& bankcard);
24+
};
25+
ostream& operator<<(ostream& output, const BankCard& bankcard)
26+
{
27+
cout << "Long code: " << bankcard.long_code << endl;
28+
cout << "Password: " << bankcard.password << endl;
29+
cout << "Balance: " << bankcard.balance << endl;
30+
cout<< "Expired date:" << bankcard.expired_month << "/" << bankcard.expired_year << endl;
31+
return output;
32+
}

Univeristy Task/Exam.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
class Exam{
3+
string _date;
4+
float _point;
5+
Lesson _lesson;
6+
public:
7+
Exam() = default;
8+
Exam(string date,float point,Lesson lesson) {
9+
_date = date;
10+
_point = point;
11+
_lesson = lesson;
12+
}
13+
14+
string getDate() { return _date; }
15+
float getPoint() { return _point; }
16+
Lesson getLesson() { return _lesson; }
17+
friend ostream& operator<<(ostream& output, const Exam& exam);
18+
};
19+
ostream& operator<<(ostream& output, const Exam& exam) {
20+
cout <<"Date: " << exam._date << endl;
21+
cout << "Point: " << exam._point << endl;
22+
cout <<"Lesson: " << exam._lesson << endl;
23+
24+
return output;
25+
}

Univeristy Task/Group.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
class Group {
3+
string _name;
4+
vector<Student> _students;
5+
vector<Lesson>_lessons;
6+
public:
7+
Group() = default;
8+
Group(string name){
9+
_name = name;
10+
}
11+
string getName() { return _name; }
12+
vector<Student>& getStudents() { return _students; };
13+
vector<Lesson>& getLessons() { return _lessons; };
14+
friend ostream& operator<<(ostream& output, const Group& group);
15+
};
16+
ostream& operator<<(ostream& output, const Group& group){
17+
cout << "Name: " << group._name << endl;
18+
cout << "Students: ";
19+
for (size_t i = 0; i < group._students.size(); i++){
20+
cout << group._students[i]._name << ' ' << group._students[i]._surname << endl;
21+
}
22+
cout << "Lessons: ";
23+
for (size_t i = 0; i < group._lessons.size(); i++){
24+
cout << group._lessons[i] << endl;
25+
}
26+
return output;
27+
}

Univeristy Task/Lesson.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
class Lesson {
3+
string _name;
4+
public:
5+
Lesson() = default;
6+
Lesson(string name) {
7+
_name = name;
8+
}
9+
string getLessonName() { return _name; }
10+
friend ostream& operator<<(ostream& output, const Lesson& lesson);
11+
};
12+
ostream& operator<<(ostream& output, const Lesson& lesson)
13+
{
14+
cout << lesson._name;
15+
return output;
16+
}

Univeristy Task/Student.h

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#pragma once
2+
class Student {
3+
string _speciality;
4+
float _score;
5+
float _money;
6+
BankCard _bankcard;
7+
vector<Exam>_exams;
8+
public:
9+
string _name;
10+
string _surname;
11+
Student() = default;
12+
Student(string name,string surname,string speciality,float score,float money,BankCard bankcard){
13+
_name=name;
14+
_surname=surname;
15+
_speciality=speciality;
16+
_score=score;
17+
_money=money;
18+
_bankcard = bankcard;
19+
}
20+
string getName() { return _name; }
21+
string getSurname() { return _surname; }
22+
string getSpeciality() { return _speciality; }
23+
vector<Exam>& getExams() { return _exams; }
24+
double getMoney() { return _money; }
25+
double getScore() { return _score; }
26+
BankCard getBankcard() { return _bankcard; }
27+
float showBalance() { return _bankcard.getBalance(); }
28+
friend ostream& operator<<(ostream& output, const Student& student);
29+
};
30+
ostream& operator<<(ostream& output, const Student& student)
31+
{
32+
cout << "----- Student ----- " << endl;
33+
cout << "Name: " << student._name << endl;
34+
cout << "Surname: " << student._surname << endl;
35+
cout << "Speciality: " << student._speciality << endl;
36+
cout << "Score: " << student._score << endl;
37+
cout << "Money: " << student._money << endl;
38+
cout << "----- Bankcard ----- " <<endl;
39+
cout << student._bankcard << endl;
40+
cout << "------- Exams -------" << endl;
41+
for (size_t i = 0; i < student._exams.size(); i++){
42+
cout << student._exams[i] << endl;
43+
}
44+
return output;
45+
}

Univeristy Task/Teachers.h

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#pragma once
2+
class Teacher {
3+
string _name;
4+
string _surname;
5+
short _age;
6+
vector<Group> _groups;
7+
string _department;
8+
float _salary;
9+
BankCard _bankcard;
10+
public:
11+
Teacher() = default;
12+
Teacher(string name,string surname,short age,string department,float salary,BankCard bankcard){
13+
_name=name;
14+
_surname=surname;
15+
_age=age;
16+
_department=department;
17+
_salary=salary;
18+
_bankcard= bankcard;
19+
}
20+
21+
string getName() { return _name; }
22+
string getSurname() { return _surname; }
23+
short getAge() { return _age; }
24+
vector<Group>& getGroups() { return _groups; }
25+
string getDepartment() { return _department; }
26+
float getSalary() { return _salary; }
27+
BankCard getBankcard() { return _bankcard; }
28+
29+
friend ostream& operator<<(ostream& output, const Teacher& teachers);
30+
};
31+
ostream& operator<<(ostream& output, const Teacher& teachers){
32+
cout << "----- Teacher -----" << endl;
33+
cout << "Name: " << teachers._name << endl;
34+
cout << "Surname: " << teachers._surname << endl;
35+
cout << "Age: " << teachers._age << endl;
36+
cout << "Department: " << teachers._department << endl;
37+
cout<< "Salary: " << teachers._salary << endl;
38+
cout << "Groups: ";
39+
for (size_t i = 0; i < 1; i++){
40+
cout << teachers._groups[i]<< endl;
41+
}
42+
cout << "BankCard: " << teachers._bankcard<< endl;
43+
return output;
44+
}

Univeristy Task/Univeristy Task.cpp

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#include <iostream>
2+
#include <vector>
3+
using namespace std;
4+
#include "Lesson.h"
5+
#include "Exam.h"
6+
#include "BankCard.h"
7+
#include "Bank.h"
8+
#include "Student.h"
9+
#include "Group.h"
10+
#include "Teachers.h"
11+
#include "Univeristy.h"
12+
13+
14+
int main(){
15+
Student s1{ "Jenette","Blankenship","Design",59,88,BankCard{"4716 7757 8328 8949",1321,148,7,24}};
16+
Student s2{ "Ina","Holden","Design",78,130,BankCard{"4024 0071 4787 4553",1001,294,7,24}};
17+
Student s3{ "Honorato","Marquez","Economics",89,150,BankCard{"4532 2516 6717 2585",7945,357,9,25}};
18+
Student s4{ "Shana","Vaughan","Economics",95,150,BankCard{"4539 3422 9636 5287",1478,541,9,25}};
19+
Student s5{ "Zephania","Bean","IT",68,88,BankCard{"4485 6539 9544 6853",7531,109,3,28}};
20+
Student s6{ "Phyllis","Durham","IT",74,130,BankCard{"4156 5731 2153 2889",9851,55,3,28}};
21+
Exam e1{ "12.1.2022",88,Lesson{"History of Design"} };
22+
Exam e2{ "18.3.2022",67,Lesson{"Design programmesign"} };
23+
Exam e3{ "27.4.2022",95,Lesson{"Economic Theory"} };
24+
Exam e4{ "04.5.2021",25,Lesson{"Macro Economic"} };
25+
Exam e5{ "01.2.2021",100,Lesson{"IT"} };
26+
Exam e6{ "22.11.2021",78,Lesson{"Programming language - Python"} };
27+
s1.getExams().push_back(e1);
28+
s2.getExams().push_back(e2);
29+
s3.getExams().push_back(e3);
30+
s4.getExams().push_back(e4);
31+
s5.getExams().push_back(e5);
32+
s6.getExams().push_back(e6);
33+
34+
Group g1("Group 1");
35+
g1.getStudents().push_back(s1);
36+
g1.getStudents().push_back(s2);
37+
38+
g1.getLessons().push_back(Lesson{"History of Design"});
39+
g1.getLessons().push_back(Lesson{"Design programmes"});
40+
41+
Group g2("Group 2");
42+
g2.getStudents().push_back(s3);
43+
g2.getStudents().push_back(s4);
44+
45+
g2.getLessons().push_back(Lesson{ "Economic Theory" });
46+
g2.getLessons().push_back(Lesson{ "Macro Economic" });
47+
48+
Group g3("Group 3");
49+
g3.getStudents().push_back(s5);
50+
g3.getStudents().push_back(s6);
51+
52+
g3.getLessons().push_back(Lesson{"IT Essentials"});
53+
g3.getLessons().push_back(Lesson{"Programming language - Python"});
54+
55+
56+
Teacher t1("Ulric", "Booth", 27, "History", 980, BankCard{ "4522 4332 3488 1557",1463, 2198, 12, 2055 });
57+
t1.getGroups().push_back(g1);
58+
59+
Teacher t2("MacKenzie", "Higgins", 45, "History", 900, BankCard{ "4485 7678 7347 1617", 7913, 1240, 8, 2042});
60+
t2.getGroups().push_back(g1);
61+
62+
Teacher t3("Ferdinand", "Phelps", 54, "Economics", 1200, BankCard{ "4716 3549 7473 5157", 7319, 3746, 4 ,2028});
63+
t3.getGroups().push_back(g2);
64+
65+
Teacher t4("Lillith", "Crosby", 37, "Economics", 1500, BankCard{ "4716 8677 5177 9577", 1346, 4000, 10, 2045 });
66+
t4.getGroups().push_back(g2);
67+
68+
Teacher t5("Sylvester", "Guzman", 24, "IT", 1400, BankCard{ "4929 8456 1484 4633", 1752,2500, 7 ,2058 });
69+
t5.getGroups().push_back(g3);
70+
71+
Teacher t6("Valentine", "Eaton", 30, "Programming", 2100, BankCard{ "4376 6576 3863 1955", 1973, 8400, 8, 2052});
72+
t6.getGroups().push_back(g3);
73+
74+
75+
76+
Bank bank("Unibank", "Settar Behlulzade","****");
77+
bank.getBankcards().push_back(s1.getBankcard());
78+
bank.getBankcards().push_back(s2.getBankcard());
79+
bank.getBankcards().push_back(s3.getBankcard());
80+
bank.getBankcards().push_back(s4.getBankcard());
81+
bank.getBankcards().push_back(s5.getBankcard());
82+
bank.getBankcards().push_back(s6.getBankcard());
83+
bank.getBankcards().push_back(t1.getBankcard());
84+
bank.getBankcards().push_back(t2.getBankcard());
85+
bank.getBankcards().push_back(t3.getBankcard());
86+
bank.getBankcards().push_back(t4.getBankcard());
87+
bank.getBankcards().push_back(t5.getBankcard());
88+
bank.getBankcards().push_back(t6.getBankcard());
89+
90+
Univeristy university("BDU","Yasamal");
91+
university.getStudents().push_back(s1);
92+
university.getStudents().push_back(s2);
93+
university.getStudents().push_back(s3);
94+
university.getStudents().push_back(s4);
95+
university.getStudents().push_back(s5);
96+
university.getStudents().push_back(s6);
97+
98+
university.getTeachers().push_back(t1);
99+
university.getTeachers().push_back(t2);
100+
university.getTeachers().push_back(t3);
101+
university.getTeachers().push_back(t4);
102+
university.getTeachers().push_back(t5);
103+
university.getTeachers().push_back(t6);
104+
105+
106+
107+
cout << "University: " << university.getName() << endl;
108+
cout << "Location: " << university.getLocation() << endl;
109+
cout << "University score: " << university.getUniversityscore() << endl;
110+
cout << "All payment: " << university.getPayment() << endl;
111+
university.showAllstudents();
112+
university.showAllteachers();
113+
cout << "Bank info " << endl;
114+
cout << "Name: " << bank.getName() << endl;
115+
cout << "Location: " << bank.getLocation() << endl;
116+
cout << "Popularity: " << bank.getPopularity() << endl;
117+
118+
}
119+

0 commit comments

Comments
 (0)