Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cstdlib>
- using namespace std;
- enum level {
- junior,
- middle,
- senior
- };
- class Programmer
- {
- private:
- string fullName;
- int stage;
- level emp_level;
- public:
- void write_code()
- {
- switch(emp_level)
- {
- case junior:
- cout << "Wrote " << rand() % 10 * 10 << " lines of code." << endl;
- break;
- case middle:
- cout << "Wrote " << rand() % 10 * 100 << " lines of code." << endl;
- break;
- case senior:
- cout << "Wrote " << rand() % 10 * 1000 << " lines of code." << endl;
- }
- }
- // working with levels
- level getEmpLevel()
- {
- return emp_level;
- }
- void setEmpLevel(level lvl)
- {
- emp_level = lvl;
- }
- // working with fullName
- string getFullName()
- {
- return fullName;
- }
- void setFullName(string fname)
- {
- fullName = fname;
- }
- // working with stage
- int getStage()
- {
- return stage;
- }
- void setStage(int st)
- {
- stage = st;
- }
- // programmer can debug his program
- void debugCode()
- {
- switch(emp_level)
- {
- case junior:
- cout << "Fixed " << rand() % 2 << " bugs in code." << endl;
- break;
- case middle:
- cout << "Fixed " << rand() % 5 << " bugs in code." << endl;
- break;
- case senior:
- cout << "Fixed " << rand() % 10 << " bugs in code." << endl;
- break;
- }
- }
- // programmer's raise up
- void raiseUp()
- {
- switch(emp_level)
- {
- case junior:
- emp_level += 1;
- cout << "Congratulations, now you're middle level!" << endl;
- break;
- case middle:
- emp_level += 1;
- cout << "Congratulations, now you're senior level!" << endl;
- break;
- case senior:
- cout << "Sorry, you've already reached your level limit!" << endl;
- break;
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement