{"id":22438915,"url":"https://github.com/cypri1-dev/42_cpp05","last_synced_at":"2025-06-19T17:32:54.634Z","repository":{"id":265248958,"uuid":"895579756","full_name":"cypri1-dev/42_CPP05","owner":"cypri1-dev","description":"This project simulates a bureaucracy in C++ with classes like Bureaucrat, Form, and Intern. It explores exceptions, grade-based access control, and dynamic form creation. The goal is to blend logical rigor with advanced object-oriented programming concepts.","archived":false,"fork":false,"pushed_at":"2024-12-10T12:35:44.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T09:23:40.625Z","etag":null,"topics":["42cpp","42projects","cpp05"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cypri1-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-28T13:25:43.000Z","updated_at":"2024-12-10T12:35:48.000Z","dependencies_parsed_at":"2024-11-28T14:32:45.308Z","dependency_job_id":"4f4f69d4-ec75-4d4b-93e2-dfd10c67553f","html_url":"https://github.com/cypri1-dev/42_CPP05","commit_stats":null,"previous_names":["cypri1-dev/42_cpp05"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cypri1-dev/42_CPP05","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP05","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP05/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP05/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP05/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cypri1-dev","download_url":"https://codeload.github.com/cypri1-dev/42_CPP05/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypri1-dev%2F42_CPP05/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260796863,"owners_count":23064647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42cpp","42projects","cpp05"],"created_at":"2024-12-06T01:12:09.049Z","updated_at":"2025-06-19T17:32:49.623Z","avatar_url":"https://github.com/cypri1-dev.png","language":"C++","readme":"\u003ch1\u003e\u003cimg src=\"https://raw.githubusercontent.com/ayogun/42-project-badges/refs/heads/main/covers/cover-cpp-bonus.png\"\u003e\u003c/h1\u003e\n\n## Description\n This project simulates a bureaucracy in C++ with classes like Bureaucrat, Form, and Intern. It explores exceptions, grade-based access control, and dynamic form creation. The goal is to blend logical rigor with advanced object-oriented programming concepts. \n\n# C++ Module 05 - Bureaucracy Simulation\n\n## Description\nThis module introduces C++ exception handling by simulating a bureaucratic environment. Through various exercises, we will build a class structure to model **Bureaucrats**, **Forms**, and other typical entities of a complex administration.\n\n## Structure of Exercises\nEach exercise builds on the previous one to add new functionalities and complexities.\n\n## **Exercise 00: Mommy, when I grow up, I want to be a bureaucrat!**\n\n- Implement a `Bureaucrat` class with:\n  - A constant name.\n  - A grade between **1** (highest) and **150** (lowest).\n  - Exceptions:\n    - `GradeTooHighException` if the grade exceeds 1.\n    - `GradeTooLowException` if the grade exceeds 150.\n  - Methods:\n    - `getName()` and `getGrade()`.\n    - `incrementGrade()` and `decrementGrade()` to modify the grade.\n  - Overload the `\u003c\u003c` operator to display `\u003cname\u003e, bureaucrat grade \u003cgrade\u003e`.\n\n### **Exercise 01: Form up, maggots!**\n\n- Add a `Form` class with:\n  - A constant name.\n  - A signed state (initially `false`).\n  - Two constant grades:\n    - One to sign.\n    - One to execute.\n  - Methods:\n    - Getters for all attributes.\n    - `beSigned(Bureaucrat\u0026)`: Allows a bureaucrat to sign the form if their grade is high enough; otherwise, throws an exception.\n  - Exceptions:\n    - `GradeTooHighException` and `GradeTooLowException`.\n  - Add `Bureaucrat::signForm()` to handle form signing.\n\n## **Exercise 02: No, you need form 28B, not 28C...**\n\n- Create an abstract class `AForm` and three concrete classes:\n  - `ShrubberyCreationForm`: Creates an ASCII file representing trees.\n  - `RobotomyRequestForm`: Simulates robotization, succeeding 50% of the time.\n  - `PresidentialPardonForm`: Announces that a pardon has been granted.\n- Add:\n  - `AForm::execute(Bureaucrat const\u0026)`: Verifies if the form is signed and if the grade is sufficient.\n  - `Bureaucrat::executeForm(AForm const\u0026)`: Attempts to execute a form and handles errors.\n\n## **Exercise 03: At least this beats coffee-making**\n\n- Implement the `Intern` class:\n  - Method `makeForm()`: Dynamically creates instances of forms (`ShrubberyCreationForm`, `RobotomyRequestForm`, `PresidentialPardonForm`) based on a name and a target.\n  - Handles errors if the form name is invalid.\n\n## Compilation\nA `Makefile` is provided for easy compilation of the files.\n```bash\nmake\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypri1-dev%2F42_cpp05","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcypri1-dev%2F42_cpp05","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypri1-dev%2F42_cpp05/lists"}