-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fatih Cil
committed
Sep 12, 2022
1 parent
8ba3672
commit 061ee93
Showing
5 changed files
with
42 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: fcil <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/09/11 21:39:02 by fcil #+# #+# */ | ||
/* Updated: 2022/09/12 12:44:58 by fcil ### ########.fr */ | ||
/* Updated: 2022/09/12 13:59:01 by fcil ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -39,7 +39,7 @@ class Bureaucrat | |
class GradeTooHighException : public std::exception | ||
{ | ||
public: | ||
const char* what() const throw() | ||
virtual const char* what() const throw() | ||
{ | ||
return ("Grade is too High."); | ||
} | ||
|
@@ -48,7 +48,7 @@ class Bureaucrat | |
class GradeTooLowException : public std::exception | ||
{ | ||
public: | ||
const char* what() const throw() | ||
virtual const char* what() const throw() | ||
{ | ||
return ("Grade is too Low."); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: fcil <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/09/12 12:00:32 by fcil #+# #+# */ | ||
/* Updated: 2022/09/12 14:59:31 by fcil ### ########.fr */ | ||
/* Updated: 2022/09/12 15:15:06 by fcil ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -70,7 +70,7 @@ void Bureaucrat::signForm(Form &form) | |
if (form.getSignGrade() >= this->getGrade()) | ||
{ | ||
form.setSignedResult(true); | ||
std::cout << "<" << this->getName() << "> signs <" << | ||
std::cout << "<" << this->getName() << "> signed <" << | ||
form.getName() << ">" << std::endl; | ||
} | ||
else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: fcil <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/09/11 21:39:02 by fcil #+# #+# */ | ||
/* Updated: 2022/09/12 14:55:03 by fcil ### ########.fr */ | ||
/* Updated: 2022/09/12 15:02:49 by fcil ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -19,6 +19,8 @@ | |
#define LOWEST 150 | ||
#define HIGHEST 1 | ||
|
||
class Form; | ||
|
||
class Bureaucrat | ||
{ | ||
private: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,16 @@ | |
/* By: fcil <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/09/12 13:46:52 by fcil #+# #+# */ | ||
/* Updated: 2022/09/12 14:56:35 by fcil ### ########.fr */ | ||
/* Updated: 2022/09/12 15:02:31 by fcil ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#pragma once | ||
|
||
#include "Bureaucrat.hpp" | ||
|
||
class Bureaucrat; | ||
|
||
class Form | ||
{ | ||
private: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,58 +6,48 @@ | |
/* By: fcil <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/09/12 11:42:20 by fcil #+# #+# */ | ||
/* Updated: 2022/09/12 13:06:26 by fcil ### ########.fr */ | ||
/* Updated: 2022/09/12 15:16:00 by fcil ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "Bureaucrat.hpp" | ||
|
||
int main(void) | ||
{ | ||
try | ||
{ | ||
Bureaucrat f("fatih", 4); | ||
std::cout << f << std::endl; | ||
} | ||
catch(const Bureaucrat::GradeTooHighException &e) | ||
{ | ||
std::cerr << e.what() << std::endl; | ||
} | ||
try | ||
{ | ||
Bureaucrat a("abyerk", 200); | ||
} | ||
catch(const std::exception& e) | ||
{ | ||
std::cerr << e.what() << std::endl; | ||
} | ||
try | ||
{ | ||
Bureaucrat bureaucrat1("uwu", 1); | ||
bureaucrat1.incrementGrade(); | ||
std::cout << bureaucrat1 << std::endl; | ||
{ | ||
Form form1("Player Contract", 150, 150); | ||
Bureaucrat bCrat1("Richarlison", 1); | ||
form1.beSigned(bCrat1); | ||
std::cout << "Welcome to the Club" << std::endl; | ||
bCrat1.incrementGrade(); | ||
} | ||
catch (Bureaucrat::GradeTooHighException &e) | ||
{ | ||
std::cerr << e.what() << std::endl; | ||
catch (std::exception &e) | ||
{ | ||
std::cout << "About to print the exception" << std::endl; | ||
std::cout << e.what() << std::endl; | ||
} | ||
catch (Bureaucrat::GradeTooLowException &e) | ||
{ | ||
std::cerr << e.what() << std::endl; | ||
} | ||
|
||
|
||
std::cout << "<<<<<<<<<<<<>>>>>>>>>>>" << std::endl; | ||
try | ||
{ | ||
Bureaucrat bureaucrat2("blabla", 150); | ||
bureaucrat2.decrementGrade(); | ||
std::cout << bureaucrat2 << std::endl; | ||
} | ||
catch (Bureaucrat::GradeTooHighException &e) | ||
{ | ||
std::cerr << e.what() << std::endl; | ||
{ | ||
Form form1("Drivers License", 1, 1); | ||
std::cout << form1; | ||
Bureaucrat bCrat1("Caitlyn Jenner", 150); | ||
form1.beSigned(bCrat1); | ||
} | ||
catch (Bureaucrat::GradeTooLowException &e) | ||
{ | ||
std::cerr << e.what() << std::endl; | ||
catch (std::exception &e) | ||
{ | ||
std::cout << "About to print the exception" << std::endl; | ||
std::cout << e.what() << std::endl; | ||
} | ||
std::cout << "<<<<<<<<<<<<<>>>>>>>>>>>>>" << std::endl; | ||
Form form1("uwu", 60, 60); | ||
std::cout << form1; | ||
Bureaucrat bCrat1("aa", 50); | ||
Bureaucrat bCrat2("bb", 120); | ||
bCrat1.signForm(form1); | ||
std::cout << form1; | ||
bCrat2.signForm(form1); | ||
std::cout << "<<<<<<<<<<<<<>>>>>>>>>>>>>" << std::endl; | ||
} |