SlideShare a Scribd company logo
1 of 8
Be sure to read all of Chapters 8 and 9 before starting this
assignment. Your job is to update your payroll program for
Armadillo Automotive Group to use a C++ class. Each
employee class object should hold the master file information
for one employee. You can assume that the company has exactly
6 employees. Use an array of employee objects to hold the
master file information for the company employees.
Do not put any pay information, including hours worked, in an
Employee object. You might want to create a paycheck struct or
object to hold pay information for one employee (this could
include the hours worked).
DO NOT DO ANY INPUT OR OUTPUT IN ANY CLASS
MEMBER FUNCTION.
The employee information and hours worked will come from
input files instead of from the keyboard.
Employee class
Create a class to represent the master file information for one
employee. Start with this partial Employee class:
class Employee
{
private:
int id; // employee ID
string name; // employee name
double hourlyPay; // pay per hour
int numDeps; // number of dependents
int type; // employee type
public:
Employee( int initId=0, string initName="",
double initHourlyPay=0.0,
int initNumDeps=0, int initType=0 ); // Constructor
bool set(int newId, string newName, double newHourlyPay,
int newNumDeps, int newType);
};
Employee::Employee( int initId, string initName,
double initHourlyPay,
int initNumDeps, int initType )
{
bool status = set( initId, initName, initHourlyPay,
initNumDeps, initType );
if ( !status )
{
id = 0;
name = "";
hourlyPay = 0.0;
numDeps = 0;
type = 0;
}
}
bool Employee::set( int newId, string newName, double
newHourlyPay,
int newNumDeps, int newType )
{
bool status = false;
if ( newId > 0 && newHourlyPay > 0 && newNumDeps >= 0
&&
newType >= 0 && newType <= 1 )
{
status = true;
id = newId;
name = newName;
hourlyPay = newHourlyPay;
numDeps = newNumDeps;
type = newType;
}
return status;
}
Note that the constructor and set functions do validation on the
data that is to be stored in the Employee object. They are
similar to the validation in the Rectangle class from the
textbook in
Section 7.11 Focus on Software Engineering: Separating class
Specification, Implementation and Client Code.
For a more detailed discussion of validation for class objects,
and the Employee class validation, see
Employee Data Validation
.
You should be able to copy this class into your editor by
highlighting the code, making a copy of it (ctrl-c in Windows),
and then pasting the code into your editor window.
Do not make any changes to the data members of the class. Do
not add any new data members to the class. Do not make any
changes to the constructor and set functions.
To complete the class, add a "get" function for each of the
private data members (that is, 5 functions). Each get function
should return the value of a data member.
Program input
The program input consists of two files - a master file and a
transaction file. Your code must work for the 2 input files
provided. You may also want to test your program with other
input data.
Master file
The master file has one line of input per employee containing:
employee ID number (integer value)
name (20 characters) - see Hint 6 below on how to input the
name
pay rate per hour (floating-point value)
number of dependents (integer value)
type of employee (0 for union, 1 for management)
This file is ordered by ID number and contains information for
6 emplyees. You can assume that there is exactly one space
between the employee ID number and the name. You can also
assume that the name occupies 20 columns in the file.
Important:
See the
Requirements/Hints
section at the bottom of this page for more information on the
input files.
Transaction file (weekly timesheet information)
The transaction file has one line for each employee containing:
number of hours worked for the week (floating-point value)
This file is also ordered by employee ID number and contains
information for the 6 employees. Note: You can assume that the
master file and the transaction file have the same number of
records, and that the first hours worked is for the first
employee, etc. You can also assume that the employee IDs in
the master file are exactly the same as the employee IDs in the
transaction file.
Important:
See the
Requirements/Hints
section at the bottom of this page for more information on the
input files.
Calculations
Gross Pay - Union members are paid 1.5 times their normal pay
rate for any hours worked over 40. Management employees are
paid their normal pay rate for all hours worked (they are not
paid extra for hours over 40).
Tax - All employees pay a flat 15% income tax.
Insurance - The company pays for insurance for the employee.
Employees are required to buy insurance for their dependents at
a price of $20 per dependent.
Net Pay is Gross Pay minus Tax minus Insurance.
Payroll Processing
Notice that when you store employee master information in an
Employee object, the set() function does data validation. If any
of the employee master information is invalid, the set() function
stores default values in the Employee object. In particular, the
ID of the employee is set to zero.
When processing the payroll:
If the employee master information for the employee is invalid
(if the ID is 0), print an appropriate error message on the screen
and do not pay the employee. The employee should not appear
in the Payroll Report.
If the hours worked for an employee is invalid (less than 0.0),
print an appropriate error message on the screen. The employee
should not be paid and should not appear in the Payroll Report.
When all employees have been processed, print on the screen
the total number of transactions that were processed correctly
during the run.
Payroll Report
This report should be printed to a file. It should not be printed
on the screen. The payroll report should be printed in a tabular
(row and column) format with each column clearly labeled. Do
not use tabs to align your columns - you need to use the setw()
manipulator. Print one line for each transaction that contains:
employee ID number
name
gross pay
tax
insurance
net pay
The final line of the payroll report should print the total gross
pay for all employees, and the total net pay for all employees.
Requirements/Hints:
Global variables are variables that are declared outside any
function.
Do not use global variables in your programs.
Declare all your variables inside functions
A sample Master file and Transaction file can downloaded here:
master9.txt
trans9.txt
Your program must work correctly for these files.
Maybe the best way to copy a file to your computer is to right-
click on the link, then choose "Save As" or "Save Link As" from
the popup menu. Optionally you may be able to open the text
file in your browser and select "Save As" or "Save Page As"
from your browser menu.
If you create your own test files in a text editor, be sure to press
the enter key after the last line of input and before you save
your text. If you choose to copy the text from my sample file
and paste it into a text editor, be sure to press the enter key
after the last line of input and before you same your text.
Use the C++
string
class to hold the employee name.
You should use an Employee class object to hold the master file
information for one employee.
The Payroll Report should be written to a file.
Notes on reading C++ string objects:
The getline function is first introduced in Chapter 3 and then
covered more thoroughly in the Files chapter. The C++ code:
string name;
getline( cin, name );
will read all characters up to the end of the line (to the first
newline character in the input stream). You can specify a
character other than the newline character to stop the input. For
example:
getline( cin, name, '#' );
will read all characters until the '#' is found in the input. The
Transaction file uses the '#' to mark the end of the names so that
they are all 20 characters long.
Note that you can use getline with input file streams by
replacing cin with the input file object.

More Related Content

Similar to Be sure to read all of Chapters 8 and 9 before starting this assignm.docx

Cyber Security wk 8 paperAssignment 2 Implementing Network a.docx
Cyber Security wk 8 paperAssignment 2 Implementing Network a.docxCyber Security wk 8 paperAssignment 2 Implementing Network a.docx
Cyber Security wk 8 paperAssignment 2 Implementing Network a.docxtheodorelove43763
 
Looks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdfLooks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdfbadshetoms
 
C++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsC++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsTawnaDelatorrejs
 
Cis407 a ilab 1 web application development devry university
Cis407 a ilab 1 web application development devry universityCis407 a ilab 1 web application development devry university
Cis407 a ilab 1 web application development devry universitylhkslkdh89009
 
Cis 407 i lab 1 of 7
Cis 407 i lab 1 of 7Cis 407 i lab 1 of 7
Cis 407 i lab 1 of 7helpido9
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxlorindajamieson
 
142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculations142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculationsuday reddy
 
Comp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source codeComp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source codepradesigali1
 
SAP BPC Learning Notes and Insights.docx
SAP BPC Learning Notes and Insights.docxSAP BPC Learning Notes and Insights.docx
SAP BPC Learning Notes and Insights.docxKen T
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfpnaran46
 
Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7helpido9
 
Make sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdfMake sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdfadityastores21
 
Check printing in_r12
Check printing in_r12Check printing in_r12
Check printing in_r12Rajesh Khatri
 
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxhoney690131
 
Cis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universityCis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universitylhkslkdh89009
 
CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces  CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces HomeWork-Fox
 
Genius CV Documentation
Genius CV DocumentationGenius CV Documentation
Genius CV DocumentationAhmad Aljariry
 

Similar to Be sure to read all of Chapters 8 and 9 before starting this assignm.docx (20)

Cyber Security wk 8 paperAssignment 2 Implementing Network a.docx
Cyber Security wk 8 paperAssignment 2 Implementing Network a.docxCyber Security wk 8 paperAssignment 2 Implementing Network a.docx
Cyber Security wk 8 paperAssignment 2 Implementing Network a.docx
 
Looks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdfLooks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdf
 
C++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsC++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment Instructions
 
Cis407 a ilab 1 web application development devry university
Cis407 a ilab 1 web application development devry universityCis407 a ilab 1 web application development devry university
Cis407 a ilab 1 web application development devry university
 
Cis 407 i lab 1 of 7
Cis 407 i lab 1 of 7Cis 407 i lab 1 of 7
Cis 407 i lab 1 of 7
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
 
142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculations142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculations
 
Comp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source codeComp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source code
 
SAP BPC Learning Notes and Insights.docx
SAP BPC Learning Notes and Insights.docxSAP BPC Learning Notes and Insights.docx
SAP BPC Learning Notes and Insights.docx
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdf
 
Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7
 
A06
A06A06
A06
 
Make sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdfMake sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdf
 
Check printing in_r12
Check printing in_r12Check printing in_r12
Check printing in_r12
 
EPF E Return FAQ
EPF E Return FAQEPF E Return FAQ
EPF E Return FAQ
 
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docxPart 1 - Microsoft AccessView GlossaryUse Access to create a.docx
Part 1 - Microsoft AccessView GlossaryUse Access to create a.docx
 
Cis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universityCis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry university
 
CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces  CIS 247C iLab 4 of 7: Composition and Class Interfaces
CIS 247C iLab 4 of 7: Composition and Class Interfaces
 
Genius CV Documentation
Genius CV DocumentationGenius CV Documentation
Genius CV Documentation
 
Jazz
JazzJazz
Jazz
 

More from aman341480

Paracentesis diagnostic procedure ALT Active Learning Template .docx
Paracentesis diagnostic procedure ALT Active Learning Template .docxParacentesis diagnostic procedure ALT Active Learning Template .docx
Paracentesis diagnostic procedure ALT Active Learning Template .docxaman341480
 
Paper to include Name of the Culture,(Italian)Country of Origin.docx
Paper to include Name of the Culture,(Italian)Country of Origin.docxPaper to include Name of the Culture,(Italian)Country of Origin.docx
Paper to include Name of the Culture,(Italian)Country of Origin.docxaman341480
 
Paper on Tone What is Flannery O’Connor really discussing in A.docx
Paper on Tone What is Flannery O’Connor really discussing in A.docxPaper on Tone What is Flannery O’Connor really discussing in A.docx
Paper on Tone What is Flannery O’Connor really discussing in A.docxaman341480
 
PAPERSDecember 2008 Project Management Jou.docx
PAPERSDecember 2008  Project Management Jou.docxPAPERSDecember 2008  Project Management Jou.docx
PAPERSDecember 2008 Project Management Jou.docxaman341480
 
PAPER TOPIC You may choose any biological, chemical or physic.docx
PAPER TOPIC You may choose any biological, chemical or physic.docxPAPER TOPIC You may choose any biological, chemical or physic.docx
PAPER TOPIC You may choose any biological, chemical or physic.docxaman341480
 
Paper Instructions Paper 1 is your first attempt at an argumen.docx
Paper Instructions Paper 1 is your first attempt at an argumen.docxPaper Instructions Paper 1 is your first attempt at an argumen.docx
Paper Instructions Paper 1 is your first attempt at an argumen.docxaman341480
 
Paper to include Name of the Culture,(Italian)Country of Or.docx
Paper to include Name of the Culture,(Italian)Country of Or.docxPaper to include Name of the Culture,(Italian)Country of Or.docx
Paper to include Name of the Culture,(Italian)Country of Or.docxaman341480
 
PAPER EXPECTATIONSFollow the instructions.Make your ideas .docx
PAPER EXPECTATIONSFollow the instructions.Make your ideas .docxPAPER EXPECTATIONSFollow the instructions.Make your ideas .docx
PAPER EXPECTATIONSFollow the instructions.Make your ideas .docxaman341480
 
Paper Title (use style paper title)Note Sub-titles are not.docx
Paper Title (use style paper title)Note Sub-titles are not.docxPaper Title (use style paper title)Note Sub-titles are not.docx
Paper Title (use style paper title)Note Sub-titles are not.docxaman341480
 
Paper requirementsMust be eight to ten pages in length (exclud.docx
Paper requirementsMust be eight to ten pages in length (exclud.docxPaper requirementsMust be eight to ten pages in length (exclud.docx
Paper requirementsMust be eight to ten pages in length (exclud.docxaman341480
 
Paper is due March 15th. Needed it by March 14th for reviewT.docx
Paper is due March 15th. Needed it by March 14th for reviewT.docxPaper is due March 15th. Needed it by March 14th for reviewT.docx
Paper is due March 15th. Needed it by March 14th for reviewT.docxaman341480
 
Paper deadline[10 pts] Due Saturday 0321 Turn in the followin.docx
Paper deadline[10 pts] Due Saturday 0321 Turn in the followin.docxPaper deadline[10 pts] Due Saturday 0321 Turn in the followin.docx
Paper deadline[10 pts] Due Saturday 0321 Turn in the followin.docxaman341480
 
Paper C Topic Selection (Individual) and Research of an existin.docx
Paper C Topic Selection (Individual) and Research of an existin.docxPaper C Topic Selection (Individual) and Research of an existin.docx
Paper C Topic Selection (Individual) and Research of an existin.docxaman341480
 
Paper Ba matrix mapping of a key IT-related organizational (o.docx
Paper Ba matrix mapping of a key IT-related organizational (o.docxPaper Ba matrix mapping of a key IT-related organizational (o.docx
Paper Ba matrix mapping of a key IT-related organizational (o.docxaman341480
 
Paper CriteriaTopic selection—A current governmental policy re.docx
Paper CriteriaTopic selection—A current governmental policy re.docxPaper CriteriaTopic selection—A current governmental policy re.docx
Paper CriteriaTopic selection—A current governmental policy re.docxaman341480
 
Paper Analysis Essay The 5-page Paper You Submit Must At L.docx
Paper Analysis Essay The 5-page Paper You Submit Must At L.docxPaper Analysis Essay The 5-page Paper You Submit Must At L.docx
Paper Analysis Essay The 5-page Paper You Submit Must At L.docxaman341480
 
Paper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docx
Paper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docxPaper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docx
Paper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docxaman341480
 
Page 1 of 2 Summer 2020 AFR 110N Sec. 101, Dr. Gove.docx
Page 1 of 2  Summer 2020 AFR 110N Sec. 101, Dr. Gove.docxPage 1 of 2  Summer 2020 AFR 110N Sec. 101, Dr. Gove.docx
Page 1 of 2 Summer 2020 AFR 110N Sec. 101, Dr. Gove.docxaman341480
 
Page 1 of 4 NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docx
Page 1 of 4    NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docxPage 1 of 4    NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docx
Page 1 of 4 NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docxaman341480
 
Page 2 (BSBMGT516 Facilitate continuous improvementLea.docx
Page  2 (BSBMGT516 Facilitate continuous improvementLea.docxPage  2 (BSBMGT516 Facilitate continuous improvementLea.docx
Page 2 (BSBMGT516 Facilitate continuous improvementLea.docxaman341480
 

More from aman341480 (20)

Paracentesis diagnostic procedure ALT Active Learning Template .docx
Paracentesis diagnostic procedure ALT Active Learning Template .docxParacentesis diagnostic procedure ALT Active Learning Template .docx
Paracentesis diagnostic procedure ALT Active Learning Template .docx
 
Paper to include Name of the Culture,(Italian)Country of Origin.docx
Paper to include Name of the Culture,(Italian)Country of Origin.docxPaper to include Name of the Culture,(Italian)Country of Origin.docx
Paper to include Name of the Culture,(Italian)Country of Origin.docx
 
Paper on Tone What is Flannery O’Connor really discussing in A.docx
Paper on Tone What is Flannery O’Connor really discussing in A.docxPaper on Tone What is Flannery O’Connor really discussing in A.docx
Paper on Tone What is Flannery O’Connor really discussing in A.docx
 
PAPERSDecember 2008 Project Management Jou.docx
PAPERSDecember 2008  Project Management Jou.docxPAPERSDecember 2008  Project Management Jou.docx
PAPERSDecember 2008 Project Management Jou.docx
 
PAPER TOPIC You may choose any biological, chemical or physic.docx
PAPER TOPIC You may choose any biological, chemical or physic.docxPAPER TOPIC You may choose any biological, chemical or physic.docx
PAPER TOPIC You may choose any biological, chemical or physic.docx
 
Paper Instructions Paper 1 is your first attempt at an argumen.docx
Paper Instructions Paper 1 is your first attempt at an argumen.docxPaper Instructions Paper 1 is your first attempt at an argumen.docx
Paper Instructions Paper 1 is your first attempt at an argumen.docx
 
Paper to include Name of the Culture,(Italian)Country of Or.docx
Paper to include Name of the Culture,(Italian)Country of Or.docxPaper to include Name of the Culture,(Italian)Country of Or.docx
Paper to include Name of the Culture,(Italian)Country of Or.docx
 
PAPER EXPECTATIONSFollow the instructions.Make your ideas .docx
PAPER EXPECTATIONSFollow the instructions.Make your ideas .docxPAPER EXPECTATIONSFollow the instructions.Make your ideas .docx
PAPER EXPECTATIONSFollow the instructions.Make your ideas .docx
 
Paper Title (use style paper title)Note Sub-titles are not.docx
Paper Title (use style paper title)Note Sub-titles are not.docxPaper Title (use style paper title)Note Sub-titles are not.docx
Paper Title (use style paper title)Note Sub-titles are not.docx
 
Paper requirementsMust be eight to ten pages in length (exclud.docx
Paper requirementsMust be eight to ten pages in length (exclud.docxPaper requirementsMust be eight to ten pages in length (exclud.docx
Paper requirementsMust be eight to ten pages in length (exclud.docx
 
Paper is due March 15th. Needed it by March 14th for reviewT.docx
Paper is due March 15th. Needed it by March 14th for reviewT.docxPaper is due March 15th. Needed it by March 14th for reviewT.docx
Paper is due March 15th. Needed it by March 14th for reviewT.docx
 
Paper deadline[10 pts] Due Saturday 0321 Turn in the followin.docx
Paper deadline[10 pts] Due Saturday 0321 Turn in the followin.docxPaper deadline[10 pts] Due Saturday 0321 Turn in the followin.docx
Paper deadline[10 pts] Due Saturday 0321 Turn in the followin.docx
 
Paper C Topic Selection (Individual) and Research of an existin.docx
Paper C Topic Selection (Individual) and Research of an existin.docxPaper C Topic Selection (Individual) and Research of an existin.docx
Paper C Topic Selection (Individual) and Research of an existin.docx
 
Paper Ba matrix mapping of a key IT-related organizational (o.docx
Paper Ba matrix mapping of a key IT-related organizational (o.docxPaper Ba matrix mapping of a key IT-related organizational (o.docx
Paper Ba matrix mapping of a key IT-related organizational (o.docx
 
Paper CriteriaTopic selection—A current governmental policy re.docx
Paper CriteriaTopic selection—A current governmental policy re.docxPaper CriteriaTopic selection—A current governmental policy re.docx
Paper CriteriaTopic selection—A current governmental policy re.docx
 
Paper Analysis Essay The 5-page Paper You Submit Must At L.docx
Paper Analysis Essay The 5-page Paper You Submit Must At L.docxPaper Analysis Essay The 5-page Paper You Submit Must At L.docx
Paper Analysis Essay The 5-page Paper You Submit Must At L.docx
 
Paper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docx
Paper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docxPaper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docx
Paper #4 PromptDue Date April 17Rough Draft (Optional) Due A.docx
 
Page 1 of 2 Summer 2020 AFR 110N Sec. 101, Dr. Gove.docx
Page 1 of 2  Summer 2020 AFR 110N Sec. 101, Dr. Gove.docxPage 1 of 2  Summer 2020 AFR 110N Sec. 101, Dr. Gove.docx
Page 1 of 2 Summer 2020 AFR 110N Sec. 101, Dr. Gove.docx
 
Page 1 of 4 NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docx
Page 1 of 4    NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docxPage 1 of 4    NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docx
Page 1 of 4 NIZWA COLLEGE OF TECHNOLOGY BUSINESS .docx
 
Page 2 (BSBMGT516 Facilitate continuous improvementLea.docx
Page  2 (BSBMGT516 Facilitate continuous improvementLea.docxPage  2 (BSBMGT516 Facilitate continuous improvementLea.docx
Page 2 (BSBMGT516 Facilitate continuous improvementLea.docx
 

Recently uploaded

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Recently uploaded (20)

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Be sure to read all of Chapters 8 and 9 before starting this assignm.docx

  • 1. Be sure to read all of Chapters 8 and 9 before starting this assignment. Your job is to update your payroll program for Armadillo Automotive Group to use a C++ class. Each employee class object should hold the master file information for one employee. You can assume that the company has exactly 6 employees. Use an array of employee objects to hold the master file information for the company employees. Do not put any pay information, including hours worked, in an Employee object. You might want to create a paycheck struct or object to hold pay information for one employee (this could include the hours worked). DO NOT DO ANY INPUT OR OUTPUT IN ANY CLASS MEMBER FUNCTION. The employee information and hours worked will come from input files instead of from the keyboard. Employee class Create a class to represent the master file information for one employee. Start with this partial Employee class: class Employee { private: int id; // employee ID string name; // employee name double hourlyPay; // pay per hour int numDeps; // number of dependents int type; // employee type
  • 2. public: Employee( int initId=0, string initName="", double initHourlyPay=0.0, int initNumDeps=0, int initType=0 ); // Constructor bool set(int newId, string newName, double newHourlyPay, int newNumDeps, int newType); }; Employee::Employee( int initId, string initName, double initHourlyPay, int initNumDeps, int initType ) { bool status = set( initId, initName, initHourlyPay, initNumDeps, initType ); if ( !status )
  • 3. { id = 0; name = ""; hourlyPay = 0.0; numDeps = 0; type = 0; } } bool Employee::set( int newId, string newName, double newHourlyPay, int newNumDeps, int newType ) { bool status = false; if ( newId > 0 && newHourlyPay > 0 && newNumDeps >= 0 && newType >= 0 && newType <= 1 ) {
  • 4. status = true; id = newId; name = newName; hourlyPay = newHourlyPay; numDeps = newNumDeps; type = newType; } return status; } Note that the constructor and set functions do validation on the data that is to be stored in the Employee object. They are similar to the validation in the Rectangle class from the textbook in Section 7.11 Focus on Software Engineering: Separating class Specification, Implementation and Client Code. For a more detailed discussion of validation for class objects, and the Employee class validation, see Employee Data Validation . You should be able to copy this class into your editor by highlighting the code, making a copy of it (ctrl-c in Windows), and then pasting the code into your editor window. Do not make any changes to the data members of the class. Do not add any new data members to the class. Do not make any changes to the constructor and set functions.
  • 5. To complete the class, add a "get" function for each of the private data members (that is, 5 functions). Each get function should return the value of a data member. Program input The program input consists of two files - a master file and a transaction file. Your code must work for the 2 input files provided. You may also want to test your program with other input data. Master file The master file has one line of input per employee containing: employee ID number (integer value) name (20 characters) - see Hint 6 below on how to input the name pay rate per hour (floating-point value) number of dependents (integer value) type of employee (0 for union, 1 for management) This file is ordered by ID number and contains information for 6 emplyees. You can assume that there is exactly one space between the employee ID number and the name. You can also assume that the name occupies 20 columns in the file. Important: See the Requirements/Hints section at the bottom of this page for more information on the input files. Transaction file (weekly timesheet information) The transaction file has one line for each employee containing: number of hours worked for the week (floating-point value) This file is also ordered by employee ID number and contains information for the 6 employees. Note: You can assume that the master file and the transaction file have the same number of records, and that the first hours worked is for the first employee, etc. You can also assume that the employee IDs in the master file are exactly the same as the employee IDs in the transaction file. Important:
  • 6. See the Requirements/Hints section at the bottom of this page for more information on the input files. Calculations Gross Pay - Union members are paid 1.5 times their normal pay rate for any hours worked over 40. Management employees are paid their normal pay rate for all hours worked (they are not paid extra for hours over 40). Tax - All employees pay a flat 15% income tax. Insurance - The company pays for insurance for the employee. Employees are required to buy insurance for their dependents at a price of $20 per dependent. Net Pay is Gross Pay minus Tax minus Insurance. Payroll Processing Notice that when you store employee master information in an Employee object, the set() function does data validation. If any of the employee master information is invalid, the set() function stores default values in the Employee object. In particular, the ID of the employee is set to zero. When processing the payroll: If the employee master information for the employee is invalid (if the ID is 0), print an appropriate error message on the screen and do not pay the employee. The employee should not appear in the Payroll Report. If the hours worked for an employee is invalid (less than 0.0), print an appropriate error message on the screen. The employee should not be paid and should not appear in the Payroll Report. When all employees have been processed, print on the screen the total number of transactions that were processed correctly during the run. Payroll Report This report should be printed to a file. It should not be printed on the screen. The payroll report should be printed in a tabular (row and column) format with each column clearly labeled. Do not use tabs to align your columns - you need to use the setw()
  • 7. manipulator. Print one line for each transaction that contains: employee ID number name gross pay tax insurance net pay The final line of the payroll report should print the total gross pay for all employees, and the total net pay for all employees. Requirements/Hints: Global variables are variables that are declared outside any function. Do not use global variables in your programs. Declare all your variables inside functions A sample Master file and Transaction file can downloaded here: master9.txt trans9.txt Your program must work correctly for these files. Maybe the best way to copy a file to your computer is to right- click on the link, then choose "Save As" or "Save Link As" from the popup menu. Optionally you may be able to open the text file in your browser and select "Save As" or "Save Page As" from your browser menu. If you create your own test files in a text editor, be sure to press the enter key after the last line of input and before you save your text. If you choose to copy the text from my sample file and paste it into a text editor, be sure to press the enter key after the last line of input and before you same your text. Use the C++ string class to hold the employee name. You should use an Employee class object to hold the master file information for one employee. The Payroll Report should be written to a file. Notes on reading C++ string objects:
  • 8. The getline function is first introduced in Chapter 3 and then covered more thoroughly in the Files chapter. The C++ code: string name; getline( cin, name ); will read all characters up to the end of the line (to the first newline character in the input stream). You can specify a character other than the newline character to stop the input. For example: getline( cin, name, '#' ); will read all characters until the '#' is found in the input. The Transaction file uses the '#' to mark the end of the names so that they are all 20 characters long. Note that you can use getline with input file streams by replacing cin with the input file object.