// shipment.h - derived class from package and dest. // Will England #ifndef SHIPMENT_H #define SHIPMENT_H #include "dest.h" #include "package.h" #include #include // inherit multiple base classes. class shipment: public package, public dest { private: char method; float cost; public: shipment(); int goodShip(); void printLabel(); void calCost(); void setCost(float foo) {cost = foo;} void setMethod(char foo) {method = foo;} void setLength(int foo) {length = foo;) void setGirth(int foo) {girth = foo;} void setWeight(float foo) {weight = foo;} void setName(char * foo) {strcpy(name, foo);} void setStreet(char *foo) {strcpy(street, foo);} void setCity(char *foo) {strcpy(city, foo);} void setState(char *foo) {strcpy(state, foo);} void setZip(char *foo) {strcpy(zip, foo);} }; shipment::shipment() : dest(), package() { method = 'c'; cost = 0.0; } // function goodShip figures if the shipment fits the // criteria, and returns 1 if it is good, 0 if it is bad. int shipment::goodShip() { if ((length + girth < 110) && (weight < 200)) return(1); else return(0); } void shipment::printLabel() { cout << "\n*****************************" << "\nShip to:\n" << name << "\n" << street << "\n" << city << "\n" << state << " " << zip << "Shipping Cost: " << cost << "for " << weight << "lbs"; cout << "\n*****************************"; } void shipment::calCost() { switch (method) { case 'a': case 'A': cost = weight * 0.87; break; case 'b': case 'B': cost = weight * 1.75; break; case 'c': case 'C': cost = weight * 3.85; break; default: cout << "Dain Bramage, Will Robinson!\n"; } } #endif