Program Description: This test, or driver, program, which demonstrates the "while" // A-1-1-02
repetition statement, determines gross pay for each of // A-1-1-02
several employees. The organization pays "straight time"for // A-1-1-02
the first 40 hours worked by each employee and pays // A-1-1-02
"time-and-a-half"for all hours worked in excess of 40 hours. // A-1-1-02
The program prompts the user for hours worked and hourly pay rate // A-1-1-02
for three employees and, from that information, calculates gross // A-1-1-02
pay. A list of employee number and gross pay is displayed after // A-1-1-02
all input as been accepted. // A-1-1-02
Compiler Used: Microsoft Visual C++ 2010 Express // A-1-1-02
SourceFile Name: Payroll.cpp // A-1-1-02
*/ // A-1-1-03
#include <iostream> // A-1-1-04
#include <iomanip> // A-1-1-05
#include <string> // A-1-1-06
usingnamespace std; // A-1-1-07
class Payroll { // A-1-1-08
public: // A-1-1-09
void calculateCurrentPayroll() { // A-1-1-10
constdouble c_maximumHoursWorkedWithoutOvertimePay = 40; // A-1-3-01 TODO
conststaticint c_inputPromptWidth = 17; // A-1-3-02 TODO
double grossPay; // A-1-3-03
double hoursWorked; // A-1-3-04 TODO
double hourlyPayRate; // A-1-3-05 TODO
constdouble c_overtimePayRatePremium = 1.5; // A-1-3-06 TODO
int employeeNumber = 1; // A-1-3-07
while (employeeNumber <= getEmployeeCount()) { // A-1-3-08
cout << "Enter employee" << employeeNumber; // A-1-3-09 TODO
cout << "\n\t\tHours Worked"; // A-1-3-10 TODO
cin >> hoursWorked; // A-1-3-11 TODO
cout << "\n\t\tHourly Pay Rate"; // A-1-3-12 TODO
cin >> hourlyPayRate; // A-1-3-13 TODO
if (hoursWorked <= 40) // A-1-3-14 TODO
grossPay = hoursWorked * hourlyPayRate; // A-1-3-15 TODO
else // A-1-3-16 TODO
c_maximumHoursWorkedWithoutOvertimePay * hourlyPayRate // A-1-3-17 TODO
+ hoursWorked - c_maximumHoursWorkedWithoutOvertimePay // A-1-3-18 TODO
* hourlyPayRate * c_overtimePayRatePremium // A-1-3-19 TODO
} // A-1-3-20 TODO
employeeGrossPay[employeeNumber - 1] = grossPay; // A-1-3-21
employeeNumber++; // A-1-3-22
} // while // A-1-3-23
} // function calculateCurrentPayroll // A-1-1-11
void displayCurrentPayroll() { // A-1-1-12
int employeeNumber = 1; // A-1-3-24 TODO
employeeNumber <= getEmployeeCount() // A-1-3-25 TODO
cout << "\n\temployee number" // A-1-3-26 TODO
cout << "\t\$ fixed setprecision (2)" // A-1-3-27 TODO
cout << (index employeeNumber - 1) // A-1-3-28 TODO
int employee number // A-1-3-29 TODO
} // A-1-3-30 TODO
} // function displayCurrentPayroll // A-1-1-13
int getEmployeeCount() { // A-1-1-14
return c_employeeCount; // A-1-3-31
} // function getEmployeeCount // A-1-1-15
private: // A-1-1-16
conststaticint c_employeeCount = 3; // A-1-1-17
double employeeGrossPay[c_employeeCount]; // A-1-1-18
}; // class Payroll // A-1-1-19
int main() { // A-1-5-01
Payroll currentPayroll // A-1-5-02 TODO
string enterKey; // A-1-5-03
cout << "\nTask 06-02, Ch04, Programmed by Shawn Main"; // A-1-5-04
cout << "\n\nProgram Input:"; // A-1-5-05
int currentPayroll; // A-1-5-06 TODO
cout << "\nProgram Output:"; // A-1-5-07 TODO
cout << "\n\t # Gross Pay"; // A-1-5-08 TODO
int currentPayroll displayCurrentPayroll; // A-1-5-09 TODO
Keyboard.FlushKeys(); // A-1-5-10 TODO
cout << "\n\nEnd of program: Press <Enter> key to exit program."; // A-1-5-11
getline(cin, enterKey); // A-1-5-12
} // function main // A-1-5-13
Here what i'm supposed to be doing:
A-1-1-01) Enter the characters for beginning of a multiple-line comment
A-1-1-02) Replace this line with required beginning-of-source-file comment block
A-1-1-03) Enter characters for the ending of multiple-line comment
A-1-1-04) Enter preprocessor directive to enable program to accept keyboard input and display screen output
A-1-1-05) Enter preprocessor directive to enable program to manipulate and format streams of data
A-1-1-06) Enter preprocessor directive to enable program to work with string objects
A-1-1-07) Enter using declaration to enable program to omit the std:: prefix on cin, cout, string…:
A-1-1-08) Enter class header for class Payroll and opening brace for class’ body
A-1-1-09) Enter heading for the class’ public interface
A-1-1-10) Enter function header for member function calculateCurrentPayroll and the opening brace for function’s body
A-1-1-11) Enter closing brace for body of function
A-1-1-12) Enter function header for member function displayCurrentPayroll and the opening brace for function’s body
A-1-1-13) Enter closing brace for body of function
A-1-1-14) Enter function header for member function getEmployeeCount and the opening brace for function’s body
A-1-1-15) Enter closing brace for body of function
A-1-1-16) Enter heading for class’ private data members
A-1-1-17) DECLARE private static constant int data member c_employeeCount with a value of 3
A-1-1-18) DECLARE private double array data member employeeGrossPay with c_employeeCount elements
A-1-1-19) Enter closing brace for body of class Payroll
A-1-3-01) DECLARE local named constant double variable named c_maximumHoursWorkedWithoutOvertimePay with a value of 40.0
A-1-3-02) DECLARE local named constant int variable named c_inputPromptWidth with a value of 17
A-1-3-03) DECLARE local double variable named grossPay
A-1-3-04) DECLARE local double variable named hoursWorked
A-1-3-05) DECLARE local double variable named hourlyPayRate
A-1-3-06) DECLARE local named constant double variable named c_overtimePayRatePremium with a value of 1.5
A-1-3-07) DECLARE local int variable named employeeNumber with an initial value of 1
REPETITION HEADER:
A-1-3-08) while employeeNumber is less than or equal getEmployeeCount(), followed by opening brace for body of loop
A-1-3-09) DISPLAY input-prompt-header for employee, preceded by newline and tab escape sequence, follow by employeeNumber and colon (Exhibit Z, lines 5, 9 and 13)
A-1-3-10) DISPLAY hours-worked prompt, preceded by newline and 2 tab escape sequences, COLUMN WIDTH for input prompt, RIGHT JUSTIFICATION (Exhibit Z, lines 6, 10 and 14)
A-1-3-11) ACCEPT user keyboard input for hours worked (Exhibit Z, lines 6, 10 and 14)
A-1-3-12) DISPLAY hourly-pay-rate prompt, preceded by 2 tab escape sequences, COLUMN WIDTH for input prompt, RIGHT JUSTIFICATION (Exhibit Z, lines 7, 11 and 15)
A-1-3-13) ACCEPT user keyboard input for hourly pay rate (Exhibit Z, lines 7, 11 and 15)
DOUBLE-ALTERNATIVE IF HEADER:
A-1-3-14) IF employee did not work overtime THEN
A-1-3-15) ASSIGN value of expression (hoursWorked MULTIPLIED BY hourlyPayRate) TO variable grossPay
A-1-3-16) ELSE
A-1-3-17) ASSIGN value of expression (c_maximumHoursWorkedWithoutOvertimePay MULTIPLIED BY hourlyPayRate
A-1-3-18) PLUS (hoursWorked MINUS c_maximumHoursWorkedWithoutOvertimePay)
A-1-3-19) MULTIPLIED BY hourlyPayRate MULTIPLIED BY c_overtimePayRatePremium) TO grossPay
DOUBLE-ALTERNATIVE IF FOOTER:
A-1-3-20) Enter closing comment for double-alternative if statement
A-1-3-21) ASSIGN value of grossPay TO array element of employeeGrossPay at index employeeNumber - 1
A-1-3-22) INCREMENT employeeNumber
REPETITION FOOTER:
A-1-3-23) Enter closing brace for body of loop
A-1-3-24) DECLARE local int variable named employeeNumber with an initial value of 1
REPETITION HEADER:
A-1-3-25) while employeeNumber is less than or equal getEmployeeCount(), followed by opening brace for body of loop
Display the one-line detail for each employee
A-1-3-26) DISPLAY employee number preceded by newline and tab escape sequence
A-1-3-27) followed by tab escape sequence, dollar sign literal, FIXED, SHOWPOINT SETPRECISION of 2
A-1-3-28) followed by value of employeeGrossPay at index employeeNumber – 1 (Exhibit Z, lines 19, 20 and 21)
A-1-3-29) INCREMENT employeeNumber
REPETITION FOOTER:
A-1-3-30) Enter closing brace for body of loop
A-1-5-01) Enter function header for function main and opening brace for function’s body
A-1-5-02) DECLARE local Payroll object named currentPayroll
A-1-5-03) DECLARE local string variable named enterKey
A-1-5-04) DISPLAY task-id-and-programmer-identification line, placing newline escape sequence before line (Exhibit Z, lines 1 and 2)
A-1-5-05) DISPLAY program-input-heading line, placing 2 newline escape sequences before line (Exhibit Z, lines 3 and 4)
A-1-5-06) CALL currentPayroll object’s calculateCurrentPayroll public member function
A-1-5-07) DISPLAY program-output-heading line, placing newline escape sequence before line (Exhibit Z, lines 16 and 17)
A-1-5-08) DISPLAY column heading line, placing newline and tab escape sequence before 1st column heading and tab escape sequence before 2nd (Exhibit Z, line 18)
A-1-5-09) CALL currentPayroll object’s displayCurrentPayroll public member function
A-1-5-10) CLEAR keyboard buffer
A-1-5-11) DISPLAY end-of-program output line, placing 2 newline escape sequences before line (Exhibit Z, lines 22 and 23)
A-1-5-12) CLEAR keyboard buffer
A-1-5-13) Enter closing brace for body of function main
please help i am so confused. if you could help/explain my mistakes that would be awesome. thank you for your time
There are many syntax errors, Visual Studio should be able to help you identify the errors. You,re code blocks aren't closed properly including the class itself (brackets don't match). The else statement in calculatePayroll needs brackets and doesn't assign to grossPay. You're also missing quite a few semicolons, and the output isn't going to be what you want. There are logic errors but I would deal with the syntax first.