Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3.14 (Employee Class) Create a class called Employee that includes three pieces

ID: 3639063 • Letter: 3

Question

3.14 (Employee Class) Create a class called Employee that includes three pieces of information as data
members—a first name (type string), a last name (type string) and a monthly salary (type int). [Note: In
subsequent chapters, we’ll use numbers that contain decimal points (e.g., 2.75)— called floating-point
values—to represent dollar amounts.] Your class should have a constructor that initializes the three data
members. Provide a set and a get function for each data member. If the monthly salary is not positive, set it
to 0. Write a test program that demonstrates class Employee’s capabilities. Create two Employee objects and
display each object’s yearly salary. Then give each Employee a 10 percent raise and display each Employee’s
yearly salary again.

Explanation / Answer

#include #include using namespace std; class Invoice { private: string partNumber; string partDescription; int quantity; int pricePerItem; public: Invoice(string part, string description, int count,int price) { partNumber = part; partDescription = description; if ( count > 0 ) quantity = count; else quantity =0; if ( price > 0 ) pricePerItem = price; else pricePerItem=0; } void setPartNumber(string part) { partNumber = part; } string getPartNumber() { return partNumber; } void setPartDescription(string description ) { partDescription = description; } string getPartDescription() { return partDescription; } void setQuantity( int count ) { if ( count > 0 ) quantity = count; if ( count 0 ) pricePerItem = price; if ( price
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote