C++ incorrect results #2
<p>The Question is as follows</p>

<p>￼￼Write a program to prompt the user to enter an employee's salary per hour, the number of hours worked in the current week, and calculate his weekly salary. If he works more than 40 hours, his salary per hour is 1.5 times his original one for each hour over 40. From the gross pay, 6% is taken for social security tax, 14% for income tax, and 10 euros for union. If the employee has more than 2 kids, he pays 35 euro for health insurance. Calculate his weekly salary.</p>

<p>My <strong>updated</strong> code is this:</p>

<pre><code>#include "stdafx.h"
#include "iostream"
using namespace std;

int main()
{

double SalaryPerHour,Hours,TotalPayment,kids;
cout &lt;&lt; "Enter his salary per hour: " &lt;&lt; endl;
cin &gt;&gt; SalaryPerHour;
cout &lt;&lt; "Enter the amount of hours he worked this week: " &lt;&lt; endl;
cin &gt;&gt; Hours;
cout &lt;&lt; "How many kids does he have: " &lt;&lt; endl;
cin &gt;&gt; kids;

if ( Hours &gt; 40 )
{
     if (kids &gt; 2)
        { Hours = (Hours-40)*1.5+40;
TotalPayment = SalaryPerHour*Hours-SalaryPerHour*Hours*20/100-10-35; }
     else if (kids &lt;= 2)
        {  Hours = (Hours-40)*1.5+40;
TotalPayment = SalaryPerHour*Hours-SalaryPerHour*Hours*20/100-10; }
}

if (Hours &lt;= 40)
    {
     if (kids &gt; 2)
TotalPayment = SalaryPerHour*Hours-SalaryPerHour*Hours*20/100-10-35; 
     else if (kids &lt;=2)
TotalPayment = SalaryPerHour*Hours-SalaryPerHour*Hours*20/100-10; }

cout &lt;&lt; TotalPayment;

system("pause");

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