<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#include "employee.h"
#include "minmax.h"
#include &lt;iostream&gt;
#include &lt;iomanip&gt;

using namespace std;

template &lt;typename ItemType&gt;
ItemlyWorker&lt;ItemType&gt;::
   ItemlyWorker(const char first[] /* = "" */,
                const char last[]  /* = "" */,
                double wage_per    /* = 0  */,
                const ItemType &amp; quant     /* = 0  */)
    : Employee(first, last), wage_per_item(::max(wage_per, 0.0)),
      item_quantity(::max(quant, ItemType()))
{ }

template &lt;typename ItemType&gt;
ItemlyWorker&lt;ItemType&gt;::
   ItemlyWorker(const ItemlyWorker&lt;ItemType&gt; &amp; worker)
    : Employee(worker), wage_per_item(worker.wage_per_item),
      item_quantity(worker.item_quantity)
{ }

template &lt;typename ItemType&gt;
ItemlyWorker&lt;ItemType&gt;::
   ~ItemlyWorker() { }

template &lt;typename ItemType&gt;
ItemlyWorker&lt;ItemType&gt; &amp; ItemlyWorker&lt;ItemType&gt;::
   operator = (const ItemlyWorker &amp; worker)
{
   Employee::operator =(worker);
   wage_per_item = worker.wage_per_item;
   item_quantity = worker.item_quantity;
   return *this;
}

template &lt;typename ItemType&gt;
void ItemlyWorker&lt;ItemType&gt;::
   set_wage_per(double wage_per)
{
   wage_per_item = ::max(wage_per, 0.0);
   return;
}

template &lt;typename ItemType&gt;
void ItemlyWorker&lt;ItemType&gt;::
   set_quantity(const ItemType &amp; quant)
{
   item_quantity = ::max(quant, ItemType());
   return;
}

template &lt;typename ItemType&gt;
double ItemlyWorker&lt;ItemType&gt;::
   earnings(void) const
{
   return wage_per_item * item_quantity;
}

template &lt;typename ItemType&gt;
void ItemlyWorker&lt;ItemType&gt;::
   print(ostream &amp; out) const
{
   out &lt;&lt; endl
       &lt;&lt; setw(25) &lt;&lt; "Itemly:  ";
   Employee::print(out);
   return;
}
</pre></body></html>