Answer to Question #249695 in C++ for nnuthin

Question #249695

Write a C++ program creating a class for workers mentioning their id, name and group to which they belong. Compute their weekly wages for the number of hours they work, fixing a nominal pay rate which is a sensitive data. Include the required Accessor and mutator member functions to set and display the wages.


1
Expert's answer
2021-10-11T02:56:18-0400
#include <iostream>

using namespace std;

class worker {
public:
 worker(int id, const string &name, const string &group) {
  this->id = id;
  this->name = name;
  this->group = group;
 }
 double weekly_wage(int hours) {
  // TODO impl...
 }
private:
 int id;
 string name;
 string group;
};

int main() {
 worker w(23, "John", "P33312");
 w.weekly_wage(40);
 return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS