class Package
{
private:
// data members to store sender and recipient's address information
std::string senderName;
std::string senderAddress;
std::string senderCity;
std::string senderState;
int senderZIP;
std::string recipientName;
std::string recipientAddress;
std::string recipientCity;
std::string recipientState;
int recipientZIP;
double weight; // weight of the package
double costPerOunce; // cost per ounce to ship the package
void setSenderName( const std::string & ); // set sender's name
std::string getSenderName() const; // return sender's name
void setSenderAddress( const std::string & ); // set sender's address
std::string getSenderAddress() const; // return sender's address
void setSenderCity( const std::string & ); // set sender's city
std::string getSenderCity() const; // return sender's city
void setSenderState( const std::string & ); // set sender's state
std::string getSenderState() const; // return sender's state
void setSenderZIP( int ); // set sender's ZIP code
int getSenderZIP() const; // return sender's ZIP code
void setRecipientName( const std::string & ); // set recipient's name
std::string getRecipientName() const; // return recipient's name
void setRecipientAddress( const std::string & ); // set recipient's address
std::string getRecipientAddress() const; // return recipient's address
void setRecipientCity( const std::string & ); // set recipient's city
std::string getRecipientCity() const; // return recipient's city
void setRecipientState( const std::string & ); // set recipient's state
std::string getRecipientState() const; // return recipient's state
void setRecipientZIP( int ); // set recipient's ZIP code
int getRecipientZIP() const; // return recipient's ZIP code
void setWeight( double ); // validate and store weight
double getWeight() const; // return weight of package
void setCostPerOunce( double ); // validate and store cost per ounce
double getCostPerOunce() const; // return cost per ounce
double calculateCost() const; // calculate shipping cost for package
}; // end class Package
// constructor initializes data members
Package::Package( const string &sName, const string &sAddress,
const string &sCity, const string &sState, int sZIP,
const string &rName, const string &rAddress, const string &rCity,
const string &rState, int rZIP, double w, double cost )
: senderName( sName ), senderAddress( sAddress ), senderCity( sCity ),
senderState( sState ), senderZIP( sZIP ), recipientName( rName ),
recipientAddress( rAddress ), recipientCity( rCity ),
recipientState( rState ), recipientZIP( rZIP )
{
setWeight( w ); // validate and store weight
setCostPerOunce( cost ); // validate and store cost per ounce
} // end Package constructor
// set sender's name
void Package::setSenderName( const string &name )
{
senderName = name;
} // end function setSenderName
// return sender's name
string Package::getSenderName() const
{
return senderName;
} // end function getSenderName
// set sender's address
void Package::setSenderAddress( const string &address )
{
senderAddress = address;
} // end function setSenderAddress
// return sender's address
string Package::getSenderAddress() const
{
return senderAddress;
} // end function getSenderAddress
// set sender's city
void Package::setSenderCity( const string &city )
{
senderCity = city;
} // end function setSenderCity
// return sender's city
string Package::getSenderCity() const
{
return senderCity;
} // end function getSenderCity
// set sender's state
void Package::setSenderState( const string &state )
{
senderState = state;
} // end function setSenderState
// return sender's state
string Package::getSenderState() const
{
return senderState;
} // end function getSenderState
// set sender's ZIP code
void Package::setSenderZIP( int zip )
{
senderZIP = zip;
} // end function setSenderZIP
// return sender's ZIP code
int Package::getSenderZIP() const
{
return senderZIP;
} // end function getSenderZIP
// set recipient's name
void Package::setRecipientName( const string &name )
{
recipientName = name;
} // end function setRecipientName
// return recipient's name
string Package::getRecipientName() const
{
return recipientName;
} // end function getRecipientName
// set recipient's address
void Package::setRecipientAddress( const string &address )
{
recipientAddress = address;
} // end function setRecipientAddress
// return recipient's address
string Package::getRecipientAddress() const
{
return recipientAddress;
} // end function getRecipientAddress
// set recipient's city
void Package::setRecipientCity( const string &city )
{
recipientCity = city;
} // end function setRecipientCity
// return recipient's city
string Package::getRecipientCity() const
{
return recipientCity;
} // end function getRecipientCity
// set recipient's state
void Package::setRecipientState( const string &state )
{
recipientState = state;
} // end function setRecipientState
// return recipient's state
string Package::getRecipientState() const
{
return recipientState;
} // end function getRecipientState
// set recipient's ZIP code
void Package::setRecipientZIP( int zip )
{
recipientZIP = zip;
} // end function setRecipientZIP
// return recipient's ZIP code
int Package::getRecipientZIP() const
{
return recipientZIP;
} // end function getRecipientZIP
// validate and store weight
void Package::setWeight( double w )
{
if ( w >= 0.0 )
weight = w;
else
throw invalid_argument( "Weight must be >= 0.0" );
} // end function setWeight
// return weight of package
double Package::getWeight() const
{
return weight;
} // end function getWeight
// validate and store cost per ounce
void Package::setCostPerOunce( double cost )
{
if ( cost >= 0.0 )
costPerOunce = cost;
else
throw invalid_argument( "Cost must be >= 0.0" );
} // end function setCostPerOunce
// return cost per ounce
double Package::getCostPerOunce() const
{
return costPerOunce;
} // end function getCostPerOunce
The first linker error is telling you the linker can't find a constructor for TwoDayPackage. I see none in your implementation, but you try to invoke it in your main.
Ditto for OvernightPackage's constructor.
PLEASE USE CODE TAGS (the <> formatting button) when posting code. http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
BTW, did you happen to notice that sender and recipient are exactly the same constructs. It would make sense to make an Address class. sender and recipient become instances of that class. You can then pass instances of Address to your package constructors. Would simplify your program considerably.