Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this C ++ assignment . Question 1 Needs Grading Q'x Using modular programing concepts (creating header file and .cpp le for

I need help with this C ++ assignment .

image text in transcribedimage text in transcribedimage text in transcribed
Question 1 Needs Grading Q'x Using modular programing concepts (creating header file and .cpp le for a class) do the following implementation in \"OOP244\" namespace. a. Design a class named Employee. Employee class has the following attributes [4 Marks] 0 name : This is a Char pointer that is used to store the name of the Employee lnt empNo : a integer number of 6 digits. 0 o Hourly Rate: a double value , negative value is not acceptable 0 Hours Per Week: an integer value between 20 and 35 b. Create a memberfunction called set, that [3 Marks] 5 accepts one integer and sets the \"Hours Per Week" member data. 0 If the value received is not between 20 and 35 then it will set the \"Hours Per Week" to zero. 0 c. Create another (overloaded) member function called set. [7 Marks] o The set function gets four arguments and sets all the member data. However, they do need to be validated beforehand. If any of the parameters are invalid, instead of setting the Employee with the values, it set the Employee to a safe empty state. 0 A constant char pointer for the Employee's name 0 A integer value for the employee number 0 Adouble value for the hourly rate 0 A integer value for the hours per week a Make sure that your implementation does not create memory leaks. o The Employee's name can't be null or an empty string 0 Employee number and hourly rate can not be negative number. If the hours per week is not between 20 and 35 (inclusive) then it will set the "Hou rs Per Week" to zero. d. Create a \"No argument\" (default) constructor that sets the class to a safe empty state. [3 Marks] 0 This constructor sets the name to nuflptr, and the Employee Number, Hourly Rate and Hours Per Week to zero. e. Create a constructor that receives 4 arguments and works exactly like the set function with four arguments. [5 Marks] f. Create a destructor [3] 9. Create a member function called print() that prints the Employee information exactly as follows with the same format: [5 Marks] 0 name width as 40 0 Employee number as 6 digits 0 2 digits after decimal point for Hourly Rate 0 If name is an empty string, then the function outputs the following message Unset Employee Record o If name is not empty but \"Hours Per Week\" is zero then the function outputs the following message Fullname 123456 17.23 Invalid work hours A sample output John Doe 123456 17.23 20 Write your class definition in a header file and the function definitions in an implementation file. Both files should be written in a form that compiles and executes successfully under a standard C++ compiler. For full marks design your class to avoid code duplication (Reuse your code!) Make sure that your implementation does not create memory leaks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions