Part 1 Explanation Code
Part 1 Explanation Code
Identify the classes needed to implement the above system and the
relationship between those classes. Please give the interface
(prototype) of the classes you have decided in this part.
Answer:
From the statement we can conclude that there will be an abstract
class of “Package” which will link the different types of packages
together. The prototype of the Abstract class “Package” will be
class Package
{
protected:
Sender *S1;
Receiver *R1;
double weight;
double StandardCostPerKG;
double totalcost;
public:
virtual double costOfPackage() = 0;
virtual void display() = 0;
};
class Sender
{
protected:
string name;
Address* A1;
string mobileNumber;
public:
//Default Constructor
Sender();
};
double costOfPackage();
void display();
};
class OvernightPackage :public Package
{
protected:
double AdditionalCost;
public:
//Non Default Constructor
OvernightPackage(Sender *iS1, Receiver *iR1, double iweight, double
iStandardCostPerKG,double iAddCost);
double costOfPackage();
void display();
};
double costOfPackage();
void display();
};