Code:
#include<iostream>
#include<string>
using namespace std;
double OvertimeHours [2];
double HourlyPayRate ;
double OvertimePay;
double GrossPay;
const double StateTax = .30; //30% State Tax Rate
int main()
{
int EmployeeID;
void HourlyPayRate(double hours; double rate)
void
int MaritalStatus;
/**************************************************************************************************/
//Determines the Marital Status of Employees
switch(MaritalStatus)
{
case 'M':
case 'm':
cout<< "Married";
break;
case 'S':
case 's':
cout<< "Single";
break;
default:
cout << "Unknown Selection!\n"
<< "Choose Again.\n";
}
/**************************************************************************************************/
if (MaritalStatus == 'M' || 'm')
{
FedTax = .15 * GrossPay; //15% federal income tax for married employees
GrossPay = GrossPay - 18.00; //$18.00 medical insurance deduction
else
if (MaritalStatus == 'S' || 's')
FedTax = .20 * GrossPay; //20% federal income tax for single employees
GrossPay = GrossPay - 10.00; //$10.00 medical insurance deduction
/**************************************************************************************************/
//This function will calculate the hourly wage
void HourlyPayRate()
{
double hours = 0;
double rate = 0
cout << endl << Number of Hours Worked: ";
cin >> hours;
cout << endl << "Pay Per Hour is: ";
cin >> rate;
cout << endl;
if (hours <= 40)
{
hours = (rate * hours);
cout << endl << setiosflags(ios::fixed) << setprecision (2)
<< "The hourly worker's weekly gross is: $" << hours << endl;
return;
}
if (hours > 40)
{
hours = (rate * 40) + ((rate * 1.5) * (hours - 40));
cout << endl << setiosflags(ios::fixed) << setprecision (2)
<< "The hourly worker's weekly gross is: $" << hours << endl;
return;
}
else
{
cout << endl << "Data Entry Not Valid, Please Reenter Data." << endl;
return;
}
return;
}
Is there a better way to achieve my goal? I am not sure but it seems as though my code is out of place. Should I continue on with the way I am coding or should I use object oriented programming to create my program? if I should then how so? I am so confused