Hello I've been having to work and rework this program for weeks. I am wondering if someone cn look at and help.It will be appreciated. Here is the assignmentment info.
PART B: Rewrite Lab 4 (Pay Calculation Program)
Add these functions:
Function Name: display( )
Arguments: None
Return Value: None
Prototype: void display(void);
Action: Display name and lab number
Function Name: code_not_valid( )
Arguments: pay code (a char)
Return Value: true, if bad code; false, if good code
Prototype: bool code_not_valid(char);
Action: Use do/while loop in main to enter pay code
Test T/F value returned by function to see if another iteration is necessary
Function Name: get_pay( )
Arguments: pay code and hours (pass by value) and pay rate (pass by reference)
Return Value: pay
Prototype: double get_pay(char, double, double &)
Action: Determine pay rate and calculate pay. (Both decision constructs are in this function)
Program Interaction:
These are the inputs and the expected outputs.
Anywhere you see ???? requires your program to output some value.
Assignment 5A Programmed by yourname here
Enter Employee #, Pay Code, Hours:
1032864 M 41
Pay Rate: $??.?? Pay Amount: $???.??
Another employee to process (Y/N)? y
Enter Employee #, Pay Code, Hours:
1171955 T 38
Pay Rate: $??.?? Pay Amount: $???.??
Another employee to process (Y/N)? y
Enter Employee #, Pay Code, Hours:
1224096 O 45
Pay Rate: $??.?? Pay Amount: $???.??
Another employee to process (Y/N)? y
Enter Employee #, Pay Code, Hours:
1234567 N 40
INVALID PAY CODE
Pay Rate: $??.?? Pay Amount: $???.??
Another employee to process (Y/N)? n
Number of Employees Processed: ?? Total Payroll: $????.??
Normal Job Termination
and here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
//Project Name: Lab Assignment 5a: Using Decisions for Pay Calculations
//Programer name: Rodger Coleman
// Date written: 2/8/2022
//Description: Calculate Payroll uaing functions
#include <iostream> //Header File for console I/O
#include <iomanip>
using namespace std;
//function prototypes
void display();
bool code_not_valid(char);
double get_pay(char, double, double &);
const double MIN_WAGE = 15;
const double NORM_HOURS = 40;
// begin main Function Definition
int main()
{
int value;
// declarations
display();
string employeeID;
double hoursWorked = 0, totalPay = 0, payRate = 0;
char payCode, again;
do
{
// type in employee id, pay code and hoursworked
cout << "Enter Employee #, Pay Code, Hours:" << endl;
cin >> employeeID >> payCode >> hoursWorked;
// useing switch allows user to put in paycodes
switch (payCode){
case 'm':
case 'M': payRate = MIN_WAGE;
break;
case 'o': case 'O': payRate = MIN_WAGE + 1.00;
break;
case 't':
case 'T': payRate = MIN_WAGE + 2.00;
break;
case 'n':
case 'N':
default: cout << "you have entered the incorrect paycode" << endl;
break;
}
// calculate minimum hours worked and overtimee.
if (payRate) {
double totalPay (hoursWorked * payRate);
if (hoursWorked > NORM_HOURS)
totalPay += payRate * (hoursWorked - NORM_HOURS) * 1.5;
cout << setprecision(2) << fixed;
cout << "Pay rate: $ " << setw(2) << payRate << " Pay Amount: $ " << setw(2) << totalPay << '\n';
}
cout << "add another employee? (Y/N): ";
cin >> again;
} while ( again == 'Y' || again == 'y');
return 0;
}
*************************************************************
* //Arguments: None
* //Return Value: None
* //Prototype: void display(void);
* //Action: Display name and lab number
*************************************************************
void display()
{
cout << "Assignment 5b" << endl;
cout << "Programmed by Paul Duckworth" << endl;
}
*********************************************************************************
* //Arguments: pay code (a char)
* //Return Value: true, if bad code; false, if good code
* //Prototype: bool code_not_valid(char);
* //Action: Use do/while loop in main to enter pay code
* //Test T/F value returned by function to see if another iteration is necessary
*********************************************************************************
bool code_not_valid(char pay_code )
{
bool status;
if ()
status = true;
else
status = false;
return status;
}
*************************************************************************************
* // Arguments: pay code and hours (pass by value) and pay rate (pass by reference)
* //Return Value: pay Prototype: double get_pay(char, double, double &)
* //Action: Determine pay rate and calculate pay.
* //(Both decision constructs are in this function) *
*************************************************************************************
get_pay()
{
totalPay += payRate * (hoursWorked - NORM_HOURS) * 1.5;
return paycode + hours;
}
//end of main function.
| |