Advertisement
awsmpshk

Untitled

Apr 19th, 2020
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. enum level {
  8.   junior,
  9.   middle,
  10.   senior
  11. };
  12.  
  13. class Programmer
  14. {
  15. private:
  16.   string fullName;
  17.   int stage;
  18.   level emp_level;
  19. public:
  20.   void write_code()
  21.   {
  22.     switch(emp_level)
  23.     {
  24.       case junior:
  25.         cout << "Wrote " << rand() % 10 * 10 << " lines of code." << endl;
  26.         break;
  27.       case middle:
  28.         cout << "Wrote " << rand() % 10 * 100 << " lines of code." << endl;
  29.         break;
  30.       case senior:
  31.         cout << "Wrote " << rand() % 10 * 1000 << " lines of code." << endl;
  32.     }
  33.   }
  34.  
  35.   // working with levels
  36.   level getEmpLevel()
  37.   {
  38.     return emp_level;
  39.   }
  40.   void setEmpLevel(level lvl)
  41.   {
  42.     emp_level = lvl;
  43.   }
  44.  
  45.   // working with fullName
  46.   string getFullName()
  47.   {
  48.     return fullName;
  49.   }
  50.   void setFullName(string fname)
  51.   {
  52.     fullName = fname;
  53.   }
  54.  
  55.   // working with stage
  56.   int getStage()
  57.   {
  58.     return stage;
  59.   }
  60.   void setStage(int st)
  61.   {
  62.     stage = st;
  63.   }
  64.  
  65.   // programmer can debug his program
  66.   void debugCode()
  67.   {
  68.     switch(emp_level)
  69.     {
  70.       case junior:
  71.         cout << "Fixed " << rand() % 2 << " bugs in code." << endl;
  72.         break;
  73.       case middle:
  74.         cout << "Fixed " << rand() % 5 << " bugs in code." << endl;
  75.         break;
  76.       case senior:
  77.         cout << "Fixed " << rand() % 10 << " bugs in code." << endl;
  78.         break;
  79.     }
  80.   }
  81.  
  82.   // programmer's raise up
  83.   void raiseUp()
  84.   {
  85.     switch(emp_level)
  86.     {
  87.       case junior:
  88.         emp_level += 1;
  89.         cout << "Congratulations, now you're middle level!" << endl;
  90.         break;
  91.       case middle:
  92.         emp_level += 1;
  93.         cout << "Congratulations, now you're senior level!" << endl;
  94.         break;
  95.       case senior:
  96.         cout << "Sorry, you've already reached your level limit!" << endl;
  97.         break;
  98.     }
  99.   }
  100. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement