Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ifndef PACKAGE_H #define PACKAGE_H #include #include using namespace std; class Package { friend ostream public: Package ( const string &, const string &, const string

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
ifndef PACKAGE_H
#define PACKAGE_H
#include
#include
using namespace std;
class Package {
friend ostream
public:
Package ( const string &, const string &, const string &, const string &, int, const string &,
const string &, const string &, const string &, int, double = 0.0, double = 0.0 );
Package& setSenderName(const string &);
string getSenderName() const;
Package& setSenderAddress(const string &);
string getSenderAddress() const ;
Package& setSenderCity(const string &);
string getSenderCity() const;
Package& setSenderState(const string &);
string getSenderState() const;
Package& setSenderZipCode(int);
int getSenderZipCode() const;
Package& setRecipientName(const string &);
string getRecipientName() const;
Package& setRecipientAddress(const string &);
string getRecipientAddress() const;
Package& setRecipientCity(const string &);
string getRecipientCity() const;
Package& setRecipientState(const string &);
string getRecipientState() const;
Package& setRecipientZipCode(int);
int getRecipientZipCode() const;
Package& setWeight(double);
double getWeight() const;
Package& setCostPerOunce(double);
double getCostPerOunce() const;
double calculateCost() const;
private:
string senderName;
string senderAddress;
string senderCity;
string senderState;
int senderZip;
string recipientName;
string recipientAddress;
string recipientCity;
string recipientState;
int recipientZip;
double weight;
double costPerOunce;
};
#endif
ifndef TWODAYPACKAGE_H
#define TWODAYPACKAGE_H
#include "Package.h"
#include
#include
using namespace std;
class TwoDayPackage : public Package {
public:
TwoDayPackage( const string &, const string &, const string &, const string &, int, const string &, const string &,
const string &, const string &, int, double = 0.0, double = 0.0, double = 0.0 );
TwoDayPackage& setFlatFee( double );
double getFlatFee( ) const;
double calculateCost( ) const;
private:
double flatFee;
};
#endif
Concepts and Syntax Inheritance: creating a new class that absorbs (inherits) an existing class's capabilities, then customizes or enhances them. Base Class (also called parent class or superclass): the existing class Derived Class (also called the child class or subclass) : the new class is - a" relationship: phrase that indicates inheritance Private private members of a class are only accessible in the member functions of the class where they are defined. private members of a base class are inherited, but not directly accessible in a derived class. Public public members of a class are accessible in any function Class Hierarchy: a diagram showing the inheritance relationships among classes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions