// Implementation file for the Item class.

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#include "Item.h"


void Item::set(string n, int q, double c) {
  this->setName(n);
  this->setQuant(q);
  this->setCost(c);
}


void Item::input(istream &sin) {
  getline(sin, name, '\t');
  sin >> quant >> cost;
  sin.ignore(80, '\n');
}


void Item::output(ostream &sout) const {
  sout.setf(ios::fixed | ios::showpoint);
  sout.precision(2);
  sout << "| "
       << setiosflags(ios::left)
       << setw(20) << name.c_str()
       << resetiosflags(ios::left)
       << " | "
       << setw(5) << quant
       << " | "
       << '$' << setw(6) << cost
       << " |\n";
}
