Results always returning 0 and accessing classees
<p>I am having a couple problems with my code.</p>

<p>First off, with the code like it is, No matter what information I put in, It always returns 0, Any suggestions on where to fix this and how? I believe it has something to do with my Class Employee. How would I go about fixing this?</p>

<p>Second, How do I access the information in int total()? I need to access it for the last bit of code.</p>

<p>Also if you notice anything else that I can do to optimize my program, I welcome your suggestions. I am learning C++ as I go and will always be a Student.</p>

<pre><code>// Datamax.cpp
// Created by Kennith Adkins

#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

class Employee
{
public:
string eName;
float eHours;
float eWage;
float ePay;
float eOvertimeHours;
float eOvertimePay;
float eTotalPay;
float eTotalBaseHours;
float eTotalSalary;
float eTotalOvertimeHours;

int Overtime ()
{
    if (eHours &gt; 40)
    {
        eOvertimeHours = (eHours - 40);
        eOvertimePay = (eOvertimeHours * (eWage * 1.5));
        ePay = ((eHours - eOvertimeHours) * eWage);
        eTotalPay = ePay + eOvertimePay;
    }
    else
    {
        ePay = (eHours * eWage);
    }
}
int total()
{
    eTotalBaseHours = (employee1.eHours - employee1.eOvertimeHours) +   (employee2.eHours - employee2.eOvertimeHours) + (employee3.eHours -   employee3.eOvertimeHours);
    eTotalSalary = (employee1.eTotalPay + employee2.eTotalPay + employee3.eTotalPay);
    eTotalOvertimeHours = (employee1.eOvertimeHours + employee2.eOvertimeHours        + employee3.eOvertimeHours);
}
} employee1, employee2, employee3;

// Start the main program here
int main()
{
// Gretting
cout &lt;&lt; "Welcome to the Employee Pay Center\n";

// Employee1 information
cout &lt;&lt; "Enter the employee name: ";
cin &gt;&gt; employee1.eName;
cout &lt;&lt; "Enter the hours worked: ";
cin &gt;&gt; employee1.eHours;
cout &lt;&lt; "Enter his or her hourly wage: ";
cin &gt;&gt; employee1.eWage;
cout &lt;&lt; endl; // Adding a blank line to space the information out

// Employee2 information
cout &lt;&lt; "Enter the employee name: ";
cin &gt;&gt; employee2.eName;
cout &lt;&lt; "Enter the hours worked: ";
cin &gt;&gt; employee2.eHours;
cout &lt;&lt; "Enter his or her hourly wage: ";
cin &gt;&gt; employee2.eWage;
cout &lt;&lt; endl; // Adding a blank line to space the information out

// Employee3 information
cout &lt;&lt; "Enter the employee name: ";
cin &gt;&gt; employee3.eName;
cout &lt;&lt; "Enter the hours worked: ";
cin &gt;&gt; employee3.eHours;
cout &lt;&lt; "Enter his or her hourly wage: ";
cin &gt;&gt; employee3.eWage;
cout &lt;&lt; endl; // Adding a blank line to space the information out

// Returning the information to the Employeer
cout &lt;&lt; "Employe Name ............ = " &lt;&lt; employee1.eName &lt;&lt; "\n";
cout &lt;&lt; "Base Pay................. = " &lt;&lt; employee1.ePay &lt;&lt; "\n";
cout &lt;&lt; "Hours in Overtime........ = " &lt;&lt; employee1.eOvertimeHours &lt;&lt; "\n";
cout &lt;&lt; "Overtime Pay Amount...... = " &lt;&lt; employee1.eOvertimePay &lt;&lt; "\n";
cout &lt;&lt; "Total Pay................ = " &lt;&lt; employee1.eTotalPay &lt;&lt; "\n\n";

cout &lt;&lt; "Employe Name ............ = " &lt;&lt; employee2.eName &lt;&lt; "\n";
cout &lt;&lt; "Base Pay................. = " &lt;&lt; employee2.ePay &lt;&lt; "\n";
cout &lt;&lt; "Hours in Overtime........ = " &lt;&lt; employee2.eOvertimeHours &lt;&lt; "\n";
cout &lt;&lt; "Overtime Pay Amount...... = " &lt;&lt; employee2.eOvertimePay &lt;&lt; "\n";
cout &lt;&lt; "Total Pay................ = " &lt;&lt; employee2.eTotalPay &lt;&lt; "\n\n";

cout &lt;&lt; "Employe Name ............ = " &lt;&lt; employee3.eName &lt;&lt; "\n";
cout &lt;&lt; "Base Pay................. = " &lt;&lt; employee3.ePay &lt;&lt; "\n";
cout &lt;&lt; "Hours in Overtime........ = " &lt;&lt; employee3.eOvertimeHours &lt;&lt; "\n";
cout &lt;&lt; "Overtime Pay Amount...... = " &lt;&lt; employee3.eOvertimePay &lt;&lt; "\n";
cout &lt;&lt; "Total Pay................ = " &lt;&lt; employee3.eTotalPay &lt;&lt; "\n\n";

cout &lt;&lt; "*******************************************************\n";
cout &lt;&lt; "*****************EMPLOYEE SUMMARY DATA*****************\n";
cout &lt;&lt; "*******************************************************\n";
cout &lt;&lt; "** Total Employee Salaries............ " &lt;&lt;   "**\n";
cout &lt;&lt; "** Total Employee Hours............... " &lt;&lt;   "**\n";
cout &lt;&lt; "** Total Overtime Hours............... " &lt;&lt;   "**\n";
cout &lt;&lt; "*******************************************************\n";
    cout &lt;&lt; "*******************************************************\n";


return 0;
}
</code></pre>

<p>Hey Guys, Thanks for the help. I have most of it done now. It is displaying all the information. I am now just working on getting it to display the Employee Summary Data. I revamped my code to make it cleaner because I was trying every suggestion given to me as I learn best by hands on.</p>
