Question

part1 7.4 Create a new file (in Dev C++) and save it Write a program that...

part1

7.4 Create a new file (in Dev C++) and save it

Write a program that uses parallel arrays to store payroll data for 5 employees. The program should display each employee name and then prompt for hours and rate. Calculate and store gross pay for each employee. After the data has been entered for all employees, display each employee's ID, name, hours, rate and gross pay as a table. Use the following arrays:

  • arrEmpIDs: array of five integers, initialized with the following: {1111111, 2222222, 3333333, 4444444, 5555555}
  • arrEmpNames: array of five strings, initialized with the following: {"Jack", "Jill", "Mary", "Mike", "Dave"}
  • arrHours: array of five integers to hold number of hours worked by each employee
  • arrRates: array of five doubles to hold hourly rate for each employee
  • arrGrossPay: array of five doubles to hold gross pay for each employee

HINT: You should be able to reuse calculateGrossPay() from Homework 6.1

  • Header comments must be present
  • Prototypes must be present if functions are used
  • Hello and Goodbye messages must be shown
  • Array(s) must be used for implementation
  • Format rate and gross pay to 2 decimal places
  • Use comments and good style practices
SAMPLE RUN:
Welcome! This program will display payroll data for five employees.
Please enter hours and rate for Jack: 40 15.5
Please enter hours and rate for Jill: 40 16.5
Please enter hours and rate for Mary: 20 12.5
Please enter hours and rate for Mike: 20 12.5
Please enter hours and rate for Dave: 20 13
  ID        NAME   HOURS     RATE      GROSS
1111111     Jack     40     15.50     620.00
2222222     Jill     40     16.50     660.00
3333333     Mary     20     12.50     250.00
4444444     Mike     20     12.50     250.00
5555555     Dave     20     13.00     260.00
Exiting program. Goodbye!

========================================================

part2

7.5 Create a new file (in Dev C++) and save

Modify program Part 1 to use a vector instead of an array.

  • Header comments must be present
  • Prototypes must be present if functions are used
  • Hello and goodbye messages must be shown
  • Vector(s) must be used for implementation
  • Use comments and good style practices
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

#include <iostream>
#include<cmath>
#include<cstdlib>
#include<iomanip>
using namespace std;
int main()
{
int arrEmpIDs[]= {1111111, 2222222, 3333333, 4444444, 5555555};
string arrEmpNames[]={"Jack", "Jill", "Mary", "Mike", "Dave"};
int arrHours[5];
double arrRates[5];
double arrGrossPay[5];
for(int i=0;i<5;i++)
{
cout<<"Please enter hours and rate for "<<arrEmpNames[i]<<": ";
cin>>arrHours[i]>>arrRates[i];
arrGrossPay[i]=arrHours[i]*arrRates[i];

}
cout<<" ID \t NAME \t HOURS \t RATE \t GROSS"<<endl;
for(int i=0;i<5;i++)
{
cout<<arrEmpIDs[i]<<"\t"<<arrEmpNames[i]<<"\t"<<arrHours[i]<<"\t"<<arrRates[i]<<"\t"<<arrGrossPay[i]<<endl;
}


}

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
part1 7.4 Create a new file (in Dev C++) and save it Write a program that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a new file (in Dev C++) Modify program above to use a vector instead of...

    Create a new file (in Dev C++) Modify program above to use a vector instead of an array. Header comments must be present Prototypes must be present if functions are used Hello and goodbye messages must be shown Vector(s) must be used for implementation Use comments and good style practices ====================================================================================================== #include <iostream> using namespace std; int main() { cout<<"Welcome! This program will find the minimum and maximum numbers in an array."<<endl; cout<<"You will be asked to enter a number...

  • in C++ Write a program which uses the following arrays: empID: An array of 7 integers...

    in C++ Write a program which uses the following arrays: empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7. Hours: an array of seven integers to hold the number of hours worked by each employee. payRate: an array of seven doubles to hold each employee’s hourly pay rate. Wages: an array of seven doubles to hold each employee’s gross salary. The program...

  • C++ Linked Lists You have been hired by Employees. Inc to write an employee management system....

    C++ Linked Lists You have been hired by Employees. Inc to write an employee management system. The following are your specifications: Write a program that uses the following linked lists: bullet empId: a linked list of seven long integers to hold employee identification numbers. The array should be initialized with the following numbers: 5658845 4520125 7895122 8777541 8451277 1302850 7580489 bullet hours: a linked list of seven integers to hold the number of hours worked by each employee bullet payRate:...

  • I hope some one can help me with the Python excercise (coding) Design a program that...

    I hope some one can help me with the Python excercise (coding) Design a program that uses the following parallel arrays: ● empId: An array of seven Integers to hold employee identification numbers. The array should be initialized with the following numbers: 56588 45201 78951 87775 84512 13028 75804 ● hours: An array of seven Integers to hold the number of hours worked by each employee. ● payRate: An array of seven Reals to hold each employee’s hourly pay rate....

  • Program is to be written In C++, The output should look like the screen shot. It...

    Program is to be written In C++, The output should look like the screen shot. It should allow the user to continue to ask the user to enter all employee ID's until done and then prompt the user to enter the hours and pay rate for each employee ID. Please help:( Can you please run the program to make sure the output is just like the screenshot please? It needs to have the output that is in the screenshot provided,...

  • Please include function in this program Write a C program that will calculate the gross pay...

    Please include function in this program Write a C program that will calculate the gross pay of a set of employees utilizing pointers instead of array references. You program should continue to use all the features from past homeworks (functions, structures, constants, strings). The program should prompt the user to enter the number of hours each employee worked. When prompted, key in the hours shown below. The program determines the overtime hours (anything over 40 hours), the gross pay and...

  • Write a C program that will calculate the gross pay of a set of employees. The...

    Write a C program that will calculate the gross pay of a set of employees. The program should prompt the user to enter the number of hours each employee worked. When prompted, key in the hours shown below. The program determines the overtime hours (anything over 40 hours), the gross pay and then outputs a table in the following format. Column alignment, leading zeros in Clock#, and zero suppression in float fields is important. Use 1.5 as the overtime pay...

  • In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an...

    In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an array of structs to hold the employee information for all employees. If you choose to declare a separate struct for each employee, I will not deduct any points. However, I strongly recommend that you use an array of structs. Be sure to read through Chapter...

  • Within c++ Create a simple Employee class with name, department, and title. Create an hourlyEmployee class...

    Within c++ Create a simple Employee class with name, department, and title. Create an hourlyEmployee class (which inherits from the Employee class) for a basic payroll program to compute the net pay salary of hourly based employees. Your program should also find the average net pay for a small company. To define the class, include the appropriate data members, member functions, constructors, and access modifiers. For simplicity, use a constant tax rate of 30% to compute the tax amount. Employees...

  • In C program Consider a file that contains employee records, called "empstat.txt." The data for each...

    In C program Consider a file that contains employee records, called "empstat.txt." The data for each employee consist of the employee’s last name (up to 20 characters), employee id number (up to 11 characters), gross pay for the week (double), taxes deducted (double) for the week, and net pay (double) for the week. Create a struct to hold the employee information. Write a void function called writeEmpFile that prompts the user to enter last name, id number, gross pay and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT