Jelajahi Sumber

added subjects

bchanot 5 hari lalu
melakukan
a004ac8d34
8 mengubah file dengan 275 tambahan dan 0 penghapusan
  1. 73 0
      Module_00/DivideAndRule.cpp
  2. TEMPAT SAMPAH
      Module_00/en.subject.pdf
  3. TEMPAT SAMPAH
      Module_01/en.subject.pdf
  4. TEMPAT SAMPAH
      Module_02/en.subject.pdf
  5. TEMPAT SAMPAH
      Module_03/en.subject.pdf
  6. 202 0
      Module_04/datas.hpp
  7. TEMPAT SAMPAH
      Module_04/en.subject.pdf
  8. TEMPAT SAMPAH
      Module_05/en.subject.pdf

+ 73 - 0
Module_00/DivideAndRule.cpp

@@ -0,0 +1,73 @@
+#include <iostream>
+#include <vector>
+
+struct Account
+{
+	int id;
+	int value;
+
+
+	Account() :
+		id(-1),
+		value(0)
+	{
+	
+	}
+
+	friend std::ostream& operator << (std::ostream& p_os, const Account& p_account)
+	{
+		p_os << "[" << p_account.id << "] - [" << p_account.value << "]";
+		return (p_os);
+	}
+};
+
+struct Bank
+{
+	int liquidity;
+	std::vector<Account *> clientAccounts;
+
+	Bank() :
+		liquidity(0)
+	{
+
+	}
+
+	friend std::ostream& operator << (std::ostream& p_os, const Bank& p_bank)
+	{
+		p_os << "Bank informations : " << std::endl;
+		p_os << "Liquidity : " << p_bank.liquidity << std::endl;
+		for (auto &clientAccount : p_bank.clientAccounts)
+        p_os << *clientAccount << std::endl;
+		return (p_os);
+	}
+};
+
+int main()
+{
+	Account accountA = Account();
+	accountA.id = 0;
+	accountA.value = 100;
+
+	Account accountB = Account();
+	accountB.id = 1;
+	accountB.value = 100;
+
+	Bank bank = Bank();
+	bank.liquidity = 999;
+	bank.clientAccounts.push_back(&accountA);
+	bank.clientAccounts.push_back(&accountB);
+
+	bank.liquidity -= 200;
+	accountA.value += 400;
+
+	std::cout << "Account : " << std::endl;
+	std::cout << accountA << std::endl;
+	std::cout << accountB << std::endl;
+
+	std::cout << " ----- " << std::endl;
+
+	std::cout << "Bank : " << std::endl;
+	std::cout << bank << std::endl;
+
+	return (0);
+}

TEMPAT SAMPAH
Module_00/en.subject.pdf


TEMPAT SAMPAH
Module_01/en.subject.pdf


TEMPAT SAMPAH
Module_02/en.subject.pdf


TEMPAT SAMPAH
Module_03/en.subject.pdf


+ 202 - 0
Module_04/datas.hpp

@@ -0,0 +1,202 @@
+//If you don't know what those 2 lines are, you should look for forward declaration
+class Student;
+class Professor;
+
+/*
+You're free to edit those class as much as you like, with the only limitation that the classes must perform the required interactions with one another.
+
+You can change base pointer to smart one.
+You can change return type to ... Whatever you like.
+
+Anything, as long as you think it's smarter that what is currently writed in this file.
+*/
+
+class Course
+{
+private:
+	std::string _name;
+	Professor* _responsable;
+	std::vector<Student*> _students;
+	int _numberOfClassToGraduate;
+	int _maximumNumberOfStudent;
+public:
+	Course(std::string p_name);
+	void assign(Professor* p_professor);
+	void subscribe(Student* p_student);
+};
+
+class Room
+{
+private:
+	long long ID;
+	std::vector<Person*> _occupants;
+
+public:
+	Room();
+	bool canEnter(Person*);
+	void enter(Person*);
+	void exit(Person*);
+	
+	void printOccupant();
+};
+
+class Classroom : public Room
+{
+private:
+	Course* _currentRoom;
+
+public:
+	Classroom();
+	void assignCourse(Course* p_course);
+};
+
+class SecretarialOffice: public Room
+{
+private:
+	std::vector<Form*> _archivedForms;
+
+public:
+
+};
+
+class HeadmasterOffice : public Room
+{
+private:
+
+public:
+
+};
+
+class StaffRestRoom : public Room
+{
+private:
+
+public:
+
+};
+
+class Courtyard : public Room
+{
+private:
+
+public:
+
+};
+
+class Person
+{
+private:
+	std::string _name;
+	Room* _currentRoom;
+public:
+	Personne(std::string p_name);
+	Room* room() {return (_currentRoom);}
+};
+
+class Staff : public Person
+{
+private:
+
+public:
+	void sign(Form* p_form);
+};
+
+enum class FormType
+{
+	CourseFinished
+	NeedMoreClassRoom
+	NeedCourseCreation
+	SubscriptionToCourse
+};
+
+class Form
+{
+private:
+	FormType _formType;
+
+public:
+	Form(FormType p_formType)
+	{
+
+	}
+
+	virtual void execute() = 0;
+};
+
+class CourseFinishedForm : public Form
+{
+private:
+
+public:
+	void execute();
+};
+
+class NeedMoreClassRoomForm : public Form
+{
+private:
+
+public:
+	void execute();
+};
+
+class NeedCourseCreationForm : public Form
+{
+private:
+
+public:
+	void execute();
+};
+
+class SubscriptionToCourseForm : public Form
+{
+private:
+
+public:
+	void execute();
+};
+
+class Student : public Person
+{
+private:
+	std::vector<Course*> _subscribedCourse;
+
+public:
+	void attendClass(Classroom* p_classroom);
+	void exitClass();
+	void graduate(Course* p_course);
+};
+
+class Headmaster : public Staff
+{
+private:
+	std::vector<Form*> _formToValidate;
+	
+public:
+	void receiveForm(Form* p_form);
+};
+
+class Secretary : public Staff
+{
+private:
+
+public:
+	Form* createForm(FormType p_formType);
+	void archiveForm();
+};
+
+class Professor : public Staff
+{
+private:
+	Course* _currentCourse;
+
+public:
+	void assignCourse(Course* p_course);
+	void doClass();
+	void closeCourse();
+};
+
+enum class Event
+{
+	RingBell
+};
+

TEMPAT SAMPAH
Module_04/en.subject.pdf


TEMPAT SAMPAH
Module_05/en.subject.pdf