Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please i need codes for this problem in C++. C++Programming.. Problme1) define a

ID: 3775605 • Letter: P

Question

please i need codes for this problem in C++.

C++Programming..

Problme1)

define a class for Package service, and implement classes for TwoDayPackage and OvernightPackage service, which are derived from Package service class.

1. base class should have following data members

(Sender:) 1) name, 2) address, 3) city, 4) state and 5) ZIP code

(Recipient:) 7) name, 8) city, 9) state and 10) ZIP code

11) weight (ounce) and 12) cost (per ounce)

2. TwoDayPackage class should inherit the class function and variables. additionally the class should have flatFee (the fee for two-day-delivery service).

- if you use TwoDayPackage service, you should pay additional charge for two-day-delivery service

- you should define the class and constructor of TwoDayPackage service that inherits Package class.

- define the get/set function for FlatFee

- define the function that returns the shipping cost. (FlatFee is considered in the shipping cost)

3. The OvernightPackage class inherits the functions and variables of the Package and additionally includes a data member called overnightFeePerOunce (per-ounce surcharge for overnight-delivery service).

- OvernightPackage charges increase due to an increase in per-ounce cost due to overnight-delivery service.

- Define OvernightPackage class and constructor to inherit Package.

- Define get / set function for overnightFeePerOunce.

- Define a function that returns the freight rate considering overnightFeePerOunce.

Explanation / Answer

#include<string>
#include <iostream>
#include <iomanip>
using namespace std;
// This class Package is the base class for two other classes, TwoDayPackage and OverNightPackage.//
class Package // begins class Package
{
public:
Package(const string &, const string &, const string &, const string &, const string &, const string &, const string &, const string &, const string &, const string &, double = 0.0, double = 0.0); // constructor
// set and get functions for sender
void setSendName(const string &);
string getSendName() const;
void setSendAdd(const string &);
string getSendAdd() const;
  
void setSendCity(const string &);
string getSendCity() const;
void setSendSt(const string &);
string getSendSt() const;
void setSendZip(const string &);
string getSendZip() const;
  
// set and get functions for recipient
void setRecName(const string &);
string getRecName() const;
void setRecAdd(const string &);
string getRecAdd() const;
void setRecipientCity(const string &);
string getRecipientCity() const;
void setRecSt(const string &);
string getRecSt() const;
void setRecZip(const string &);
string getRecZip() const;
  
void setWt(double);
double getWt() const;
void setShip(double);
double getShip() const;
double CalCost() const;
private:
string sendName;
string sendAdd;
string sendCity;
string sendState;
string sendZip;
string recName;
string recAdd;
string recCity;
string recState;
string recZip;
double wt;
double shipCost;
};
Package::Package(const string &sname, const string &saddress, const string &scity, const string &sstate, const string &szipcode, const string &rname, const string &raddress, const string &rcity, const string &rstate, const string &rzipcode, double wt, double shipCost)
{
sendName = sname;
sendAdd = saddress;
sendCity = scity;
sendState = sstate;
sendZip = szipcode;
recName = rname;
recAdd = raddress;
recCity = rcity;
recState = rstate;
recZip = rzipcode;
setWt(wt);
setShip(shipCost);
}
void Package::setSendName(const string &sname)
{
sendName = sname;
}
string Package::getSendName() const
{
return sendName;
}
void Package::setSendAdd(const string &saddress)
{
sendAdd = saddress;
}
string Package::getSendAdd() const
{
return sendAdd;
}
void Package::setSendCity(const string &scity)
{
sendCity = scity;
}
string Package::getSendCity() const
{
return sendCity;
}
void Package::setSendSt(const string &sstate)
{
sendState = sstate;
}
string Package::getSendSt() const
{
return sendState;
}
void Package::setSendZip(const string &szipcode)
{
sendZip = szipcode;
}
string Package::getSendZip() const
{
return sendZip;
}
void Package::setRecName(const string &rname)
{
recName = rname;
}
string Package::getRecName() const
{
return recName;
}
void Package::setRecAdd(const string &raddress)
{
recAdd = raddress;
}
string Package::getRecAdd() const
{
return recAdd;
}
void Package::setRecipientCity(const string &rcity)
{
recCity = rcity;
}
string Package::getRecipientCity() const
{
return recCity;
}
void Package::setRecSt(const string &rstate)
{
recState = rstate;
}
string Package::getRecSt() const
{
return recState;
}
void Package::setRecZip(const string &rzipcode)
{
recZip = rzipcode;
}
string Package::getRecZip() const
{
return recZip;
}
void Package::setWt(double wt)
{
wt = (wt < 0.0 ) ? 0.0 : wt;
}
double Package::getWt() const
{
return wt;
}
void Package::setShip(double shipCost)
{
shipCost = ( shipCost < 0.0) ? 0.0 : shipCost;
}
double Package::getShip() const
{
return shipCost;
}
double Package::CalCost() const
{
return wt * shipCost;
}
// This class TwoDayPackage is the first derived class from class Package.//
class TDP : public Package
{
public:
TDP(const string &, const string &, const string &, const string &, const string &, const string &,
const string &, const string &, const string &, const string &, double = 0.0, double = 0.0, double = 0.0); // constructor
  
void setFlatFee(double);
double getFlatFee() const;
void CalCost() const;
private:
double flatFee;
};
// This class OverNightPackage is the second derived class from class Package.//
class ONP : public Package
{
public:
ONP(const string &, const string &, const string &, const string &, const string &, const string &, const string &, const string &, const string &, const string &, double=0.0, double=0.0, double=0.0); // constructor
void setFee(double);
double getFee() const;
void CalCost() const;
private:
double fee;
};
// This is the test program.//
int main()
{
ONP box("name", "123 this Street", "boston", "ma", "12345", "receiver", "123 that street", "medford", "ma", "25341", 10.00, 1.50, .85);
  
TDP parcel("name2", "123 1st Street", "orlando", "fl", "56474", "receiver2", "833 2nd Street", "miami", "fl", "88472", 15.00, 1.05, 5.00);
cout << fixed << setprecision(2);
  
cout << "To ship a box with overnight delivery ";
cout << "The sender " << box.getSendName()<< " ";
cout << " " << box.getSendAdd() << " ";
cout << " " << box.getSendCity() << " " << box.getSendSt() << " " << box.getSendZip() << " ";
  
cout << "The recipient " << box.getRecName()<< " ";
cout << " " << box.getRecAdd() << " ";
cout << " " << box.getRecipientCity() << " " << box.getRecSt() << " " << box.getRecZip() << " ";
cout << "The cost is $ " <<box.CalCost() << " ";
  
cout << " ";
cout << "To ship a parcel with 2 day delivery ";
cout << "The sender " << parcel.getSendName()<< " ";
cout << " " << parcel.getSendAdd() << " ";
cout << " " << parcel.getSendCity() << " " << parcel.getSendSt() << " " << parcel.getSendZip() << " ";
  
cout << "The recipient " << parcel.getRecName()<< " ";
cout << " " << parcel.getRecAdd() << " ";
cout << " " << parcel.getRecipientCity() << " " << parcel.getRecSt() << " " << parcel.getRecZip() << " ";
cout << "The cost is $ "<<parcel.CalCost() << " ";
system("pause");
return 0;
}