-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobotomyRequestForm.cpp
More file actions
49 lines (41 loc) · 1.12 KB
/
RobotomyRequestForm.cpp
File metadata and controls
49 lines (41 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "RobotomyRequestForm.hpp"
#include "print.hpp"
RobotomyRequestForm::RobotomyRequestForm ()
: AForm (72, 45, "RobotomyRequestForm"), _target ("Nobody")
{
}
RobotomyRequestForm::RobotomyRequestForm (std::string target)
: AForm (72, 45, "RobotomyRequestForm"), _target (target)
{
}
RobotomyRequestForm::RobotomyRequestForm (const RobotomyRequestForm &other)
: AForm (other), _target (other._target)
{
}
RobotomyRequestForm &
RobotomyRequestForm::operator= (const RobotomyRequestForm &other)
{
this->AForm::operator= (other);
return *this;
}
RobotomyRequestForm::~RobotomyRequestForm () {}
std::string
RobotomyRequestForm::getTarget () const
{
return _target;
}
void
RobotomyRequestForm::execute (const Bureaucrat &executor) const
{
static short calls_number = 1;
if (!isSigned ())
throw AForm::FormNotSignedException ();
else if (executor.getGrade () > getExecGrade ())
throw Bureaucrat::GradeTooLowException ();
print ("Bzzzzzzzzzz");
if (calls_number % 2)
print (_target << " has been robotomized successfully.");
else
print (_target << " robotomization failed.");
calls_number++;
}