Why are my calculations are off? 1 work day is supposed to equal 8 hours. : <p>I think my math isn't done right in the setter function(s). I've been staring at it too long. Thanks in advance programmers!  </p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class numDays
{
int hours;  
int days;

public:
numDays(int hrs); //constructor prototype
void setHours(int);
void setDays(int);
int  getHours();
int  getDays();

double operator+ (const numDays Object1) //overloading the + operator to   return the sum of two objects' hours members
{
return hours + Object1.hours;
}

double operator-(const numDays Object1) //overloading the + operator to     return the difference of two objects' hours members
{
return hours - Object1.hours;
}

numDays operator++() //prefix increment operator to increment # of hours   stored in object. Days are recalculated.
{
++hours;
days = hours/8;
return *this;
}

numDays operator++(int) //postfix increment operator to increment # of hours stored in object. Days are recalculated.
{
numDays temp(hours);
hours++;
days = hours/8;
return temp;
}

numDays operator--() //prefix decrement operator to decrement # of hours stored in object. Days are recalculated.
{
--hours;
days = hours/8;
return *this;
}

numDays operator-- (int) //prefix decrement operator to decrement # of     hours stored in object. Days are recalculated.
{
numDays temp(hours);
hours--;
days = hours/8;
return temp;
}

};

numDays::numDays(int hrs) //constructor that accepts a number of hours
{hours = hrs;}
</code></pre>

<p>I expect the problem is here in either the setHours function or the setDays function.</p>

<pre><code>void numDays::setHours(int hrs) //mutator function to store the amount of  hours
{
hours = hrs;
days = hrs/8;
}

void numDays::setDays(int d) //mutator function to store the amount of days
{
hours = d;
days = hours % 8;
}

int numDays::getHours() //accessor function to get the amount of hours
{
return hours;
}

int numDays::getDays() //accessor function to get the amount of days
{
return days;
}


int main()
{
int workHours;

numDays object2(0);

cout &lt;&lt; "Please type in a certain amount of hours to see how much work in  days it is: ";
cin &gt;&gt; workHours;

object2.setHours(workHours);
object2.setDays(workHours);

cout &lt;&lt; "The number of hours you put in is " &lt;&lt; object2.getHours() &lt;&lt; endl;
cout &lt;&lt; "That means you worked " &lt;&lt;object2.getDays() &lt;&lt; " days " &lt;&lt; endl;

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