SlideShare a Scribd company logo
I need help to modify my code according to the instructions:
Modify the program you created in Lab Assignment #9 (Babbage's Cabbage's, Part 3) to include
the following features:
Use parallel arrays to store the full name and gross pay of all employees entered. The size of the
arrays must be easy to change using a single symbolic constant. At the end of the program, after
all the individual employee records have been input and processed, write a summary table to the
report file listing the employees entered and their gross pay amounts. See the sample report that
follows for an example. (Your program may only store these two specific pieces of employee
data in arrays. You will not earn credit for this feature if you create additional arrays for other
pieces of employee data.)
Create individual functions for computing the sum of the gross pay amounts, the average, finding
the maximum gross pay, and the minimum gross pay. Each of these four functions can accept
only the array of gross pay amounts and number of valid data items as parameters, and cannot
depend on the array being arranged in order. Display the total, average, minimum, and maximum
of the gross pay amounts in the report file summary.
Use the optimized version of the Bubble Sort (v.3) so that the summary table of employee names
and gross pay amounts is arranged in descending order by gross pay.
Read input from a data file, rather than the user. See the sample data file that follows for an
example (note that the amount of the transportation deduction is supplied directly). You may
assume that all data provided in the file is valid. Remove all code related to keyboard input and
data validation so that the program simply reads from the data file and writes to the report file
without needing any input from the user.
Sample Report File
Submissions whose programs do not compile without errors, do not use a modular style (i.e., all
of the program code appears in the main module), or contain any of the items listed below, will
receive a grade of zero:
Global variables, Recursive module calls, vectors, structs, or classes, The line using namespace
std; Inclusion of libraries that have not been introduced as part of the class (including those that
are specific to a particular operating system), or use of their commands, Calls to the system
function
This is my code that needs to be modified:
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <ostream>
#define min_hours 10.0
#define max_hours 55.0
#define min_hourly_rate 15.00
#define max_hourly_rate 65.00
#define overtime_limit 34.0
void input_employee_data(double &hours_worked, double &hourly_wage);
void calculate_gross_pay(double &hours_worked, double &hourly_wage, double& ovt_hours,
double& reg_hours, double &gross_pay);
void calculate_net_pay(double &gross_pay, double& deduct, double &net_pay, double &taxes);
std::string input_full_name(std::string& first_name,
std::string& last_name);
std::string join_names(std::string first_name, std::string last_name, std::string& full_name);
void display_results(double gross_pay, double net_pay, double hourly_wage,
double deduct, double reg_hours, double ovt_hours, double taxes, std::string full_name);
std::string output_full_name(std::string full_name);
void show_header();
void additional_deduct(char& parking_garage, char& transit, char& bike, double &deduct);
char get_yes_no();
void output_results(std::ostream& stream, double gross_pay, double net_pay,
double hourly_wage, double deduct, double reg_hours,
double ovt_hours, double taxes, std::string full_name);
void output_results(std::ostream& stream, double gross_pay, double net_pay,
double hourly_wage, double deduct, double reg_hours,
double ovt_hours, double taxes, std::string full_name);
int main()
{
double hours_worked;
double hourly_wage;
double gross_pay;
double ovt_hours;
double reg_hours;
double deduct = 0;
double net_pay;
double taxes;
char process_another_employee;
char parking_garage;
char transit;
char bike;
std::string first_name;
std::string last_name;
std::string full_name;
std::ofstream outfile("C:/Temp/payroll.txt");
if (!outfile.is_open())
{
std::cout << "Unable to open a file!" << std::endl;
}
do
{
full_name = input_full_name(first_name, last_name);
input_employee_data(hours_worked, hourly_wage);
additional_deduct(parking_garage, transit, bike, deduct);
calculate_gross_pay(hours_worked, hourly_wage, ovt_hours, reg_hours, gross_pay);
calculate_net_pay(gross_pay, deduct, net_pay, taxes);
display_results(gross_pay, net_pay, hourly_wage, deduct, reg_hours, ovt_hours, taxes,
full_name);
process_another_employee = get_yes_no();
output_results(outfile, gross_pay, net_pay, hourly_wage, deduct,
reg_hours, ovt_hours, taxes, full_name);
} while (process_another_employee == 'Y' || process_another_employee == 'y');
if (process_another_employee == 'N' || process_another_employee == 'n') {
}
outfile.close();
}
std::string input_full_name(std::string& first_name, std::string& last_name)
{
std::string full_name;
std::cout << "Enter employee's first name: ";
std::cin >> first_name;
std::cout << "Enter employee's last name: ";
std::cin >> last_name;
join_names(first_name, last_name, full_name);
return full_name;
}
std::string join_names(std::string first_name, std::string last_name,
std::string& full_name)
{
std::string join_names;
full_name = last_name + ", " + first_name;
return join_names;
}
std::string output_full_name(std::string full_name)
{
std::string output_full_name;
std::cout << full_name;
return output_full_name;
}
void input_employee_data(double &hours_worked, double &hourly_wage)
{
std::cout << "Enter number of hours worked: ";
std::cin >> hours_worked;
while (hours_worked < min_hours || hours_worked > max_hours) {
std::cout << "The number of hours worked must be between " << min_hours << " and " <<
max_hours << " " << std::endl;
std::cout << "Enter number of hours worked: ";
std::cin >> hours_worked;
}
std::cout << "Enter hourly pay rate: ";
std::cin >> hourly_wage;
while (hourly_wage < min_hourly_rate || hourly_wage > max_hourly_rate) {
std::cout << "The hourly pay rate must be between " << min_hourly_rate << " and " <<
max_hourly_rate << " " << std::endl;
std::cout << "Enter hourly pay rate: ";
std::cin >> hourly_wage;
}
}
void additional_deduct(char& parking_garage, char& transit, char& bike, double &deduct)
{
std::cout << "Does the employee use the parking gargage? (Y/N):";
std::cin >> parking_garage;
while (parking_garage != 'Y' && parking_garage != 'y' &&
parking_garage != 'N' && parking_garage != 'n') {
std::cout << "Please type 'Y' for yes or 'N' for no" << std::endl;
std::cin >> parking_garage;
}
if (parking_garage == 'Y' || parking_garage == 'y') {
deduct += 7.50;
}
else {
std::cout << "Does employee participate in the transit program? (Y/N):";
std::cin >> transit;
while (transit != 'Y' && transit != 'y' && transit != 'N' && transit != 'n') {
std::cout << "Please type 'Y' for yes or 'N' for no" << std::endl;
std::cin >> transit;
}
if (transit == 'y' || transit == 'Y') {
deduct + 5.0;
}
else {
std::cout << "Does employee rent a bike locker? (Y/N): " << std::endl;
std::cin >> bike;
}
while (bike != 'Y' && bike != 'y' && bike != 'N' && bike != 'n') {
std::cout << "Pleae type 'Y' for yes or 'N' for no" << std::endl;
std::cin >> bike;
}
if (bike == 'Y' || bike == 'y') {
deduct += 1;
}
}
}
void calculate_gross_pay(double &hours_worked, double &hourly_wage, double &ovt_hours,
double &reg_hours, double &gross_pay)
{
if (hours_worked <= overtime_limit) {
reg_hours = hours_worked;
ovt_hours = 0;
}
else {
reg_hours = overtime_limit;
ovt_hours = hours_worked - overtime_limit;
}
gross_pay = (reg_hours * hourly_wage) + (ovt_hours * (hourly_wage * 1.5));
}
void calculate_net_pay(double &gross_pay, double& deduct, double &net_pay, double &taxes)
{
taxes = gross_pay * 0.205;
net_pay = gross_pay - taxes - deduct;
}
void show_header()
{
std::cout << std::fixed << std::setprecision(2) << std::left;
std::cout << std::setw(20) << "Name";
std::cout << std::setw(7) << "Reg";
std::cout << std::setw(7) << "Ovt";
std::cout << std::setw(9) << "Hourly";
std::cout << std::setw(8) << "Gross";
std::cout << std::setw(8) << "Taxes";
std::cout << std::setw(8) << "Deduct";
std::cout << std::setw(7) << "Net" << std::endl;
std::cout << std::setw(20) << std::left << " ";
std::cout << std::setw(7) << "Hours";
std::cout << std::setw(7) << "Hours";
std::cout << std::setw(9) << "Rate";
std::cout << std::setw(24) << "Pay";
std::cout << std::setw(16) << "Pay" << std::endl;
std::cout << "================== ===== ===== ======= ====== ====== "
"====== =====" << std::endl;
}
void display_results(double gross_pay, double net_pay,
double hourly_wage, double deduct, double reg_hours, double ovt_hours,
double taxes, std::string full_name)
{
show_header();
std::cout << std::fixed << std::setprecision(2) << std::endl << std::left;
std::cout << std::setw(20) << full_name;
std::cout << std::setw(5) << reg_hours;
std::cout << std::setw(7) << ovt_hours;
std::cout << std::setw(9) << hourly_wage;
std::cout << std::setw(8) << gross_pay;
std::cout << std::setw(8) << taxes << " ";
std::cout << std::setw(8) << deduct;
std::cout << std::setw(7) << net_pay << std::endl;
}
char get_yes_no()
{
char process_another_employee;
std::ofstream outfile;
std::cout << std::endl;
std::cout << "Do you want to process another employee (Y/N)? ";
std::cin >> process_another_employee;
if (process_another_employee != 'Y' && process_another_employee != 'y'
&& process_another_employee != 'N' && process_another_employee != 'n') {
std::cout << "Please type 'Y' for yes or 'N' for no" << std::endl;
return get_yes_no();
}
else return process_another_employee;
}
void output_results(std::ostream& stream, double gross_pay, double net_pay,
double hourly_wage, double deduct, double reg_hours,
double ovt_hours, double taxes, std::string full_name)
{
stream << std::fixed << std::setprecision(2) << std::left
<< std::setw(20) << "Name"
<< std::setw(7) << "Reg"
<< std::setw(7) << "Ovt"
<< std::setw(9) << "Hourly"
<< std::setw(8) << "Gross"
<< std::setw(8) << "Taxes"
<< std::setw(8) << "Deduct"
<< std::setw(7) << "Net" << std::endl
<< std::setw(20) << std::left << " "
<< std::setw(7) << "Hours"
<< std::setw(7) << "Hours"
<< std::setw(9) << "Rate"
<< std::setw(24) << "Pay"
<< std::setw(16) << "Pay" << std::endl
<< "================== ===== ===== ======= ====== ====== "
"====== =====" << std::endl
<< std::setw(20) << full_name
<< std::setw(5) << reg_hours
<< std::setw(9) << ovt_hours
<< std::setw(9) << hourly_wage
<< std::setw(6) << gross_pay
<< std::setw(8) << taxes << " "
<< std::setw(8) << deduct
<< std::setw(6) << net_pay << std::endl
<< std::endl;
}
Data file:

More Related Content

Similar to I need help to modify my code according to the instructions- Modify th.pdf

ParallelProgrammingBasics_v2.pdf
ParallelProgrammingBasics_v2.pdfParallelProgrammingBasics_v2.pdf
ParallelProgrammingBasics_v2.pdf
Chen-Hung Hu
 
C++ functions
C++ functionsC++ functions
C++ functions
Dawood Jutt
 
C++ functions
C++ functionsC++ functions
C++ functions
Dawood Jutt
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
Ashwin Francis
 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
RehmanRasheed3
 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 sol
IIUM
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
amrit47
 
Tt subtemplates-caching
Tt subtemplates-cachingTt subtemplates-caching
Tt subtemplates-caching
Valeriy Studennikov
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
ssuser454af01
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
yash production
 
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdf
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdfProgramming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdf
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdf
ssuser6254411
 
Code optimization
Code optimization Code optimization
Code optimization
Code optimization Code optimization
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
Quratulain Naqvi
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
WondimuBantihun1
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
AOE
 
CGI.ppt
CGI.pptCGI.ppt
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
D. j Vicky
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
D. j Vicky
 
Modify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfModify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdf
mallik3000
 

Similar to I need help to modify my code according to the instructions- Modify th.pdf (20)

ParallelProgrammingBasics_v2.pdf
ParallelProgrammingBasics_v2.pdfParallelProgrammingBasics_v2.pdf
ParallelProgrammingBasics_v2.pdf
 
C++ functions
C++ functionsC++ functions
C++ functions
 
C++ functions
C++ functionsC++ functions
C++ functions
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
 
Mid term sem 2 1415 sol
Mid term sem 2 1415 solMid term sem 2 1415 sol
Mid term sem 2 1415 sol
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 
Tt subtemplates-caching
Tt subtemplates-cachingTt subtemplates-caching
Tt subtemplates-caching
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
 
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdf
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdfProgramming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdf
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdf
 
Code optimization
Code optimization Code optimization
Code optimization
 
Code optimization
Code optimization Code optimization
Code optimization
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
 
CGI.ppt
CGI.pptCGI.ppt
CGI.ppt
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
 
Modify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfModify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdf
 

More from pnaran46

John works as a goldsmith who often repairs jewellry- Maria brought in.pdf
John works as a goldsmith who often repairs jewellry- Maria brought in.pdfJohn works as a goldsmith who often repairs jewellry- Maria brought in.pdf
John works as a goldsmith who often repairs jewellry- Maria brought in.pdf
pnaran46
 
L-{anbmcmdnn-m0} (1).pdf
L-{anbmcmdnn-m0} (1).pdfL-{anbmcmdnn-m0} (1).pdf
L-{anbmcmdnn-m0} (1).pdf
pnaran46
 
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdfHow do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
pnaran46
 
Given that x has a Poitson destribition with -1-7- what is the poobati.pdf
Given that x has a Poitson destribition with -1-7- what is the poobati.pdfGiven that x has a Poitson destribition with -1-7- what is the poobati.pdf
Given that x has a Poitson destribition with -1-7- what is the poobati.pdf
pnaran46
 
Find the p-value using Excel (not Appendix D)- (Round your answers to.pdf
Find the p-value using Excel (not Appendix D)- (Round your answers to.pdfFind the p-value using Excel (not Appendix D)- (Round your answers to.pdf
Find the p-value using Excel (not Appendix D)- (Round your answers to.pdf
pnaran46
 
Apple Inc- had gone through a hard period in the early 90s and almost.pdf
Apple Inc- had gone through a hard period in the early 90s and almost.pdfApple Inc- had gone through a hard period in the early 90s and almost.pdf
Apple Inc- had gone through a hard period in the early 90s and almost.pdf
pnaran46
 
6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf
6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf
6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf
pnaran46
 
a- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdf
a- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdfa- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdf
a- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdf
pnaran46
 
57) All of the following are non-arguments except- a- Americans are ma.pdf
57) All of the following are non-arguments except- a- Americans are ma.pdf57) All of the following are non-arguments except- a- Americans are ma.pdf
57) All of the following are non-arguments except- a- Americans are ma.pdf
pnaran46
 
2- An instructor wishes to see whether the variation in scores of the.pdf
2- An instructor wishes to see whether the variation in scores of the.pdf2- An instructor wishes to see whether the variation in scores of the.pdf
2- An instructor wishes to see whether the variation in scores of the.pdf
pnaran46
 
You are working as the chief economist for the Ministry of Economy in.pdf
You are working as the chief economist for the Ministry of Economy in.pdfYou are working as the chief economist for the Ministry of Economy in.pdf
You are working as the chief economist for the Ministry of Economy in.pdf
pnaran46
 
The Taylors agreed to make monthly payments on a mortgage of $130-000.pdf
The Taylors agreed to make monthly payments on a mortgage of $130-000.pdfThe Taylors agreed to make monthly payments on a mortgage of $130-000.pdf
The Taylors agreed to make monthly payments on a mortgage of $130-000.pdf
pnaran46
 
The supply of low-skilled workers in China is perfectly elastic- In 20.pdf
The supply of low-skilled workers in China is perfectly elastic- In 20.pdfThe supply of low-skilled workers in China is perfectly elastic- In 20.pdf
The supply of low-skilled workers in China is perfectly elastic- In 20.pdf
pnaran46
 
The Federal Reserve provides accounts to financial institutions only f.pdf
The Federal Reserve provides accounts to financial institutions only f.pdfThe Federal Reserve provides accounts to financial institutions only f.pdf
The Federal Reserve provides accounts to financial institutions only f.pdf
pnaran46
 
The following is the balance sheet numbers (in millions) reported by B.pdf
The following is the balance sheet numbers (in millions) reported by B.pdfThe following is the balance sheet numbers (in millions) reported by B.pdf
The following is the balance sheet numbers (in millions) reported by B.pdf
pnaran46
 
1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf
1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf
1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf
pnaran46
 
Singh Company reports a contribution margin of $717-000 and fixed cost.pdf
Singh Company reports a contribution margin of $717-000 and fixed cost.pdfSingh Company reports a contribution margin of $717-000 and fixed cost.pdf
Singh Company reports a contribution margin of $717-000 and fixed cost.pdf
pnaran46
 
Provide an appropriate response- How many ways can five people- A- B-.pdf
Provide an appropriate response- How many ways can five people- A- B-.pdfProvide an appropriate response- How many ways can five people- A- B-.pdf
Provide an appropriate response- How many ways can five people- A- B-.pdf
pnaran46
 
QRT Soltware creates and distributes inventory control noftware- The h.pdf
QRT Soltware creates and distributes inventory control noftware- The h.pdfQRT Soltware creates and distributes inventory control noftware- The h.pdf
QRT Soltware creates and distributes inventory control noftware- The h.pdf
pnaran46
 

More from pnaran46 (19)

John works as a goldsmith who often repairs jewellry- Maria brought in.pdf
John works as a goldsmith who often repairs jewellry- Maria brought in.pdfJohn works as a goldsmith who often repairs jewellry- Maria brought in.pdf
John works as a goldsmith who often repairs jewellry- Maria brought in.pdf
 
L-{anbmcmdnn-m0} (1).pdf
L-{anbmcmdnn-m0} (1).pdfL-{anbmcmdnn-m0} (1).pdf
L-{anbmcmdnn-m0} (1).pdf
 
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdfHow do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
How do I fix this error - Exception in thread -main- java-lang-NullPoi.pdf
 
Given that x has a Poitson destribition with -1-7- what is the poobati.pdf
Given that x has a Poitson destribition with -1-7- what is the poobati.pdfGiven that x has a Poitson destribition with -1-7- what is the poobati.pdf
Given that x has a Poitson destribition with -1-7- what is the poobati.pdf
 
Find the p-value using Excel (not Appendix D)- (Round your answers to.pdf
Find the p-value using Excel (not Appendix D)- (Round your answers to.pdfFind the p-value using Excel (not Appendix D)- (Round your answers to.pdf
Find the p-value using Excel (not Appendix D)- (Round your answers to.pdf
 
Apple Inc- had gone through a hard period in the early 90s and almost.pdf
Apple Inc- had gone through a hard period in the early 90s and almost.pdfApple Inc- had gone through a hard period in the early 90s and almost.pdf
Apple Inc- had gone through a hard period in the early 90s and almost.pdf
 
6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf
6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf
6) Cytological mapping (4 points) i) Deletional-deficiency-ii) Duplica.pdf
 
a- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdf
a- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdfa- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdf
a- Let- a host with IP address 10-0-0-10-3550 want to transmit 16 bit.pdf
 
57) All of the following are non-arguments except- a- Americans are ma.pdf
57) All of the following are non-arguments except- a- Americans are ma.pdf57) All of the following are non-arguments except- a- Americans are ma.pdf
57) All of the following are non-arguments except- a- Americans are ma.pdf
 
2- An instructor wishes to see whether the variation in scores of the.pdf
2- An instructor wishes to see whether the variation in scores of the.pdf2- An instructor wishes to see whether the variation in scores of the.pdf
2- An instructor wishes to see whether the variation in scores of the.pdf
 
You are working as the chief economist for the Ministry of Economy in.pdf
You are working as the chief economist for the Ministry of Economy in.pdfYou are working as the chief economist for the Ministry of Economy in.pdf
You are working as the chief economist for the Ministry of Economy in.pdf
 
The Taylors agreed to make monthly payments on a mortgage of $130-000.pdf
The Taylors agreed to make monthly payments on a mortgage of $130-000.pdfThe Taylors agreed to make monthly payments on a mortgage of $130-000.pdf
The Taylors agreed to make monthly payments on a mortgage of $130-000.pdf
 
The supply of low-skilled workers in China is perfectly elastic- In 20.pdf
The supply of low-skilled workers in China is perfectly elastic- In 20.pdfThe supply of low-skilled workers in China is perfectly elastic- In 20.pdf
The supply of low-skilled workers in China is perfectly elastic- In 20.pdf
 
The Federal Reserve provides accounts to financial institutions only f.pdf
The Federal Reserve provides accounts to financial institutions only f.pdfThe Federal Reserve provides accounts to financial institutions only f.pdf
The Federal Reserve provides accounts to financial institutions only f.pdf
 
The following is the balance sheet numbers (in millions) reported by B.pdf
The following is the balance sheet numbers (in millions) reported by B.pdfThe following is the balance sheet numbers (in millions) reported by B.pdf
The following is the balance sheet numbers (in millions) reported by B.pdf
 
1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf
1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf
1) Ludwig von Mises (1871 - 1973) was an influential economist from Au.pdf
 
Singh Company reports a contribution margin of $717-000 and fixed cost.pdf
Singh Company reports a contribution margin of $717-000 and fixed cost.pdfSingh Company reports a contribution margin of $717-000 and fixed cost.pdf
Singh Company reports a contribution margin of $717-000 and fixed cost.pdf
 
Provide an appropriate response- How many ways can five people- A- B-.pdf
Provide an appropriate response- How many ways can five people- A- B-.pdfProvide an appropriate response- How many ways can five people- A- B-.pdf
Provide an appropriate response- How many ways can five people- A- B-.pdf
 
QRT Soltware creates and distributes inventory control noftware- The h.pdf
QRT Soltware creates and distributes inventory control noftware- The h.pdfQRT Soltware creates and distributes inventory control noftware- The h.pdf
QRT Soltware creates and distributes inventory control noftware- The h.pdf
 

Recently uploaded

Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 

Recently uploaded (20)

Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 

I need help to modify my code according to the instructions- Modify th.pdf

  • 1. I need help to modify my code according to the instructions: Modify the program you created in Lab Assignment #9 (Babbage's Cabbage's, Part 3) to include the following features: Use parallel arrays to store the full name and gross pay of all employees entered. The size of the arrays must be easy to change using a single symbolic constant. At the end of the program, after all the individual employee records have been input and processed, write a summary table to the report file listing the employees entered and their gross pay amounts. See the sample report that follows for an example. (Your program may only store these two specific pieces of employee data in arrays. You will not earn credit for this feature if you create additional arrays for other pieces of employee data.) Create individual functions for computing the sum of the gross pay amounts, the average, finding the maximum gross pay, and the minimum gross pay. Each of these four functions can accept only the array of gross pay amounts and number of valid data items as parameters, and cannot depend on the array being arranged in order. Display the total, average, minimum, and maximum of the gross pay amounts in the report file summary. Use the optimized version of the Bubble Sort (v.3) so that the summary table of employee names and gross pay amounts is arranged in descending order by gross pay. Read input from a data file, rather than the user. See the sample data file that follows for an example (note that the amount of the transportation deduction is supplied directly). You may assume that all data provided in the file is valid. Remove all code related to keyboard input and data validation so that the program simply reads from the data file and writes to the report file without needing any input from the user. Sample Report File Submissions whose programs do not compile without errors, do not use a modular style (i.e., all of the program code appears in the main module), or contain any of the items listed below, will receive a grade of zero: Global variables, Recursive module calls, vectors, structs, or classes, The line using namespace std; Inclusion of libraries that have not been introduced as part of the class (including those that are specific to a particular operating system), or use of their commands, Calls to the system function This is my code that needs to be modified: #include <iostream> #include <iomanip> #include <string> #include <fstream> #include <ostream>
  • 2. #define min_hours 10.0 #define max_hours 55.0 #define min_hourly_rate 15.00 #define max_hourly_rate 65.00 #define overtime_limit 34.0 void input_employee_data(double &hours_worked, double &hourly_wage); void calculate_gross_pay(double &hours_worked, double &hourly_wage, double& ovt_hours, double& reg_hours, double &gross_pay); void calculate_net_pay(double &gross_pay, double& deduct, double &net_pay, double &taxes); std::string input_full_name(std::string& first_name, std::string& last_name); std::string join_names(std::string first_name, std::string last_name, std::string& full_name); void display_results(double gross_pay, double net_pay, double hourly_wage, double deduct, double reg_hours, double ovt_hours, double taxes, std::string full_name); std::string output_full_name(std::string full_name); void show_header(); void additional_deduct(char& parking_garage, char& transit, char& bike, double &deduct); char get_yes_no(); void output_results(std::ostream& stream, double gross_pay, double net_pay, double hourly_wage, double deduct, double reg_hours, double ovt_hours, double taxes, std::string full_name); void output_results(std::ostream& stream, double gross_pay, double net_pay, double hourly_wage, double deduct, double reg_hours, double ovt_hours, double taxes, std::string full_name); int main() { double hours_worked; double hourly_wage; double gross_pay; double ovt_hours; double reg_hours; double deduct = 0; double net_pay; double taxes; char process_another_employee; char parking_garage; char transit; char bike; std::string first_name; std::string last_name; std::string full_name; std::ofstream outfile("C:/Temp/payroll.txt");
  • 3. if (!outfile.is_open()) { std::cout << "Unable to open a file!" << std::endl; } do { full_name = input_full_name(first_name, last_name); input_employee_data(hours_worked, hourly_wage); additional_deduct(parking_garage, transit, bike, deduct); calculate_gross_pay(hours_worked, hourly_wage, ovt_hours, reg_hours, gross_pay); calculate_net_pay(gross_pay, deduct, net_pay, taxes); display_results(gross_pay, net_pay, hourly_wage, deduct, reg_hours, ovt_hours, taxes, full_name); process_another_employee = get_yes_no(); output_results(outfile, gross_pay, net_pay, hourly_wage, deduct, reg_hours, ovt_hours, taxes, full_name); } while (process_another_employee == 'Y' || process_another_employee == 'y'); if (process_another_employee == 'N' || process_another_employee == 'n') { } outfile.close(); } std::string input_full_name(std::string& first_name, std::string& last_name) { std::string full_name; std::cout << "Enter employee's first name: "; std::cin >> first_name; std::cout << "Enter employee's last name: "; std::cin >> last_name; join_names(first_name, last_name, full_name); return full_name; } std::string join_names(std::string first_name, std::string last_name, std::string& full_name) { std::string join_names; full_name = last_name + ", " + first_name; return join_names; }
  • 4. std::string output_full_name(std::string full_name) { std::string output_full_name; std::cout << full_name; return output_full_name; } void input_employee_data(double &hours_worked, double &hourly_wage) { std::cout << "Enter number of hours worked: "; std::cin >> hours_worked; while (hours_worked < min_hours || hours_worked > max_hours) { std::cout << "The number of hours worked must be between " << min_hours << " and " << max_hours << " " << std::endl; std::cout << "Enter number of hours worked: "; std::cin >> hours_worked; } std::cout << "Enter hourly pay rate: "; std::cin >> hourly_wage; while (hourly_wage < min_hourly_rate || hourly_wage > max_hourly_rate) { std::cout << "The hourly pay rate must be between " << min_hourly_rate << " and " << max_hourly_rate << " " << std::endl; std::cout << "Enter hourly pay rate: "; std::cin >> hourly_wage; } } void additional_deduct(char& parking_garage, char& transit, char& bike, double &deduct) { std::cout << "Does the employee use the parking gargage? (Y/N):"; std::cin >> parking_garage; while (parking_garage != 'Y' && parking_garage != 'y' && parking_garage != 'N' && parking_garage != 'n') { std::cout << "Please type 'Y' for yes or 'N' for no" << std::endl; std::cin >> parking_garage; } if (parking_garage == 'Y' || parking_garage == 'y') { deduct += 7.50; }
  • 5. else { std::cout << "Does employee participate in the transit program? (Y/N):"; std::cin >> transit; while (transit != 'Y' && transit != 'y' && transit != 'N' && transit != 'n') { std::cout << "Please type 'Y' for yes or 'N' for no" << std::endl; std::cin >> transit; } if (transit == 'y' || transit == 'Y') { deduct + 5.0; } else { std::cout << "Does employee rent a bike locker? (Y/N): " << std::endl; std::cin >> bike; } while (bike != 'Y' && bike != 'y' && bike != 'N' && bike != 'n') { std::cout << "Pleae type 'Y' for yes or 'N' for no" << std::endl; std::cin >> bike; } if (bike == 'Y' || bike == 'y') { deduct += 1; } } } void calculate_gross_pay(double &hours_worked, double &hourly_wage, double &ovt_hours, double &reg_hours, double &gross_pay) { if (hours_worked <= overtime_limit) { reg_hours = hours_worked; ovt_hours = 0; } else { reg_hours = overtime_limit; ovt_hours = hours_worked - overtime_limit; } gross_pay = (reg_hours * hourly_wage) + (ovt_hours * (hourly_wage * 1.5)); } void calculate_net_pay(double &gross_pay, double& deduct, double &net_pay, double &taxes) {
  • 6. taxes = gross_pay * 0.205; net_pay = gross_pay - taxes - deduct; } void show_header() { std::cout << std::fixed << std::setprecision(2) << std::left; std::cout << std::setw(20) << "Name"; std::cout << std::setw(7) << "Reg"; std::cout << std::setw(7) << "Ovt"; std::cout << std::setw(9) << "Hourly"; std::cout << std::setw(8) << "Gross"; std::cout << std::setw(8) << "Taxes"; std::cout << std::setw(8) << "Deduct"; std::cout << std::setw(7) << "Net" << std::endl; std::cout << std::setw(20) << std::left << " "; std::cout << std::setw(7) << "Hours"; std::cout << std::setw(7) << "Hours"; std::cout << std::setw(9) << "Rate"; std::cout << std::setw(24) << "Pay"; std::cout << std::setw(16) << "Pay" << std::endl; std::cout << "================== ===== ===== ======= ====== ====== " "====== =====" << std::endl; } void display_results(double gross_pay, double net_pay, double hourly_wage, double deduct, double reg_hours, double ovt_hours, double taxes, std::string full_name) { show_header(); std::cout << std::fixed << std::setprecision(2) << std::endl << std::left; std::cout << std::setw(20) << full_name; std::cout << std::setw(5) << reg_hours; std::cout << std::setw(7) << ovt_hours; std::cout << std::setw(9) << hourly_wage; std::cout << std::setw(8) << gross_pay; std::cout << std::setw(8) << taxes << " "; std::cout << std::setw(8) << deduct; std::cout << std::setw(7) << net_pay << std::endl; }
  • 7. char get_yes_no() { char process_another_employee; std::ofstream outfile; std::cout << std::endl; std::cout << "Do you want to process another employee (Y/N)? "; std::cin >> process_another_employee; if (process_another_employee != 'Y' && process_another_employee != 'y' && process_another_employee != 'N' && process_another_employee != 'n') { std::cout << "Please type 'Y' for yes or 'N' for no" << std::endl; return get_yes_no(); } else return process_another_employee; } void output_results(std::ostream& stream, double gross_pay, double net_pay, double hourly_wage, double deduct, double reg_hours, double ovt_hours, double taxes, std::string full_name) { stream << std::fixed << std::setprecision(2) << std::left << std::setw(20) << "Name" << std::setw(7) << "Reg" << std::setw(7) << "Ovt" << std::setw(9) << "Hourly" << std::setw(8) << "Gross" << std::setw(8) << "Taxes" << std::setw(8) << "Deduct" << std::setw(7) << "Net" << std::endl << std::setw(20) << std::left << " " << std::setw(7) << "Hours" << std::setw(7) << "Hours" << std::setw(9) << "Rate" << std::setw(24) << "Pay" << std::setw(16) << "Pay" << std::endl << "================== ===== ===== ======= ====== ====== " "====== =====" << std::endl << std::setw(20) << full_name << std::setw(5) << reg_hours << std::setw(9) << ovt_hours << std::setw(9) << hourly_wage << std::setw(6) << gross_pay << std::setw(8) << taxes << " " << std::setw(8) << deduct << std::setw(6) << net_pay << std::endl