#include #include #include #include #include using namespace std; #include "Produce.h" //Produce methods Produce::Produce() { weight = 0.0; } Produce::Produce( ifstream& fin ) { Extract( fin ); } Produce::Produce( string Name, double Markup, int Cost, double Wt ) :Grocery(Name,Markup,Cost), weight(Wt) { } double Produce::getWeight() const { return weight; } int Produce::getPrice() const { return (int)( weight * Grocery::getCost() * Grocery::getMarkup() + 0.5); } void Produce::Extract(ifstream& fin ) { string opentkn, closetkn; fin >> opentkn; //error check: opentkn == "Produce{" Get( fin ); fin >> closetkn; //error check: closetkn == "}Produce" } void Produce::Insert( ostream& fout ) { fout << endl << " Produce{ "; Put( fout ); fout << " }Produce "; } void Produce::Get( ifstream& fin) { string label1; //parse name, markup, cost Grocery::Get( fin ); //parse weight fin >> label1 >> weight; //error checks: label1 == "weight:" } void Produce::Put ( ostream& fout) { Grocery::Put( fout ); fout << " weight: " << weight; }