Computers and Technology
Computers and Technology, 23.11.2019 00:31, dre4232

Staffmemberparser class
the staffmemberparser class is a utility class that will be used to create a pointer to a staff member object (one of a volunteer object, a full time employee object, and an hourly employee object) from a parsable string. the staffmemberparser class object will not be instantiated. it must have the following public function:
static staffmember * parsestringtomember(string linetoparse)
the parsestringtomember function's argument will be a string in the following format:
for a volunteer, type/firstname/lastname/employeeid
for a full time employee, type/firstname/lastname/emloyeeid/r ate/bonus
for an hourly employee, type/firstname/lastname/emloyeeid/r ate/hoursworked
the staffmemberparser will parse this string, pull out the information, allocates memory dynamically to a new object of one of volunteer, fulltimeemployee, or hourlyemployee using their constructor with attributes of the object (depending on whether the first substring is volunteer, fulltimeemployee, or hourlyemployee), and return it to the calling function. the type will always be present and always be one of volunteer, fulltimeemployee, and hourlyemployee. you may add other functions to the volunteer, fulltimeemployee, and hourlyemployee classes in order to make your life easier.
based on code here-
//staffmember parent class
//parent class
#include
#include
using namespace std;
#ifndef staffmember_h
#define staffmember_h
class staffmember {
protected:
string firstname, lastname, memberid;
double pay;
public:
staffmember() {
firstname = "? ", lastname = "? ", memberid = "? ";
pay = 0.0;
}
staffmember(string firstname, string lastname, string memberid) {
this-> firstname = firstname;
this-> lastname = lastname;
this-> memberid = memberid;
}
string getmemberid() {
return memberid;
}
virtual void computepay() {
pay = 0.0;
}
virtual void printinfo() {
printf("\nfirst name: \t\t%s\nlast name: \t\t%s\nmember id: \t\t%s\npay: \t\t%lf\n",
firstname, lastname, memberid, pay);
}
~staffmember() {
cout < < "staff member " < < getmemberid() < < " is getting destroyed." < < endl;
}
};
#endif
//child class (example: hourlyemployee)
#include
#include
#include "staffmember. h"
using namespace std;
#ifndef hourlyemployee_h
#define hourlyemployee_h
class hourlyemployee : public staffmember {
protected:
double rate;
int hoursworked;
public:
hourlyemployee() : staffmember() {
rate = 0.0;
hoursworked = 0;
}
hourlyemployee(string firstname, string lastname, string memberid, double rate, int hoursworked)
: staffmember(firstname, lastname, memberid) {
this-> rate = rate;
this-> hoursworked = hoursworked;
}
virtual void computepay() {
pay = rate * hoursworked;
}
virtual void printinfo() {
staffmember: : printinfo();
}
};
#endif

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 05:20, reeeeeee32
What did creator markus “notch" persson initially call his game
Answers: 1
image
Computers and Technology, 23.06.2019 06:30, Knownothing
When early motion pictures played in movie theaters, they were often accompanied by live organ or piano music. which of the following are the most likely reasons that this happened? (select all that apply). the music was provided to distract audience members from the loud sounds made when filmstrips were changed. the music accompanied the movies because the movies were silent and audiences were used to hearing music during plays in theaters. the music usually was played before, and sometimes after the movie, as an alternative form of entertainment. the music viewers to interpret the dramatic action in the films.
Answers: 2
image
Computers and Technology, 23.06.2019 16:30, 19thomasar
How to do this programming flowchart?
Answers: 3
image
Computers and Technology, 23.06.2019 18:00, joybeth9591
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
Do you know the correct answer?
Staffmemberparser class
the staffmemberparser class is a utility class that will be used to c...

Questions in other subjects:

Konu
Mathematics, 19.02.2020 07:59