For some reason I get several errors but I think it has to do with the code that I commented on. Can someone help me please me out because I keep getting the same error over and over again. My code is supposed to answer the following questions: //Create a class callled Package, It should have member variables for the weight of the package and the package tracking number. Add functions to access these variables and set them in the constructor. Add a function to calculate the shipping cost, using the formula cost=$3 per pound
//Create a derived class called Box for box-shaped packages. It should store the dimensions of the height, width, and depth in inches. Redfine the function to calculate shipping where if the longest length+girth is greater than 108 inches then 30 is added to the normal cost
//Write a main function that creates a box, assigns a weight height width and depth and prints the shipping cost
#include <iostream>
#include <string>
using namespace std;
namespace shipping
{
const double COST_PER_POUND=3.0;
class Package
{
public:
Package();//default constructor
Package(double new_weight, string new_tracking_num);
double get_weight() const;//accessors
string get_tracking_num() const;//accessors
void set_weight(double new_weight);
void set_tracking_num(string new_tracking_num);
double cal_shipping() const;
private:
double weight;
string tracking_num;
};
}
#include <string>
#include "Package.h"
using namespace std;
namespace shipping
{
Package::Package(): tracking_num(""), weight(0)
{
}
Package::Package(double new_weight, string new_tracking_num):
tracking_num(new_tracking_num), weight(new_weight)
{
}
double Package::get_weight() const
{
return weight;
}
string Package::get_tracking_num() const
{
return tracking_num;
}
void Package::set_weight(double new_weight)
{
weight=new_weight;
}
void Package::set_tracking_num(string new_tracking_num)
{
tracking_num= new_tracking_num;
}
double Package::cal_shipping() const
{
return weight*COST_PER_POUND;
}
}
#include <string>
#include "Package.h"
using namespace std;
namespace shipping
{
class Box : public Package{
public:
Box();
Box(double new_weight, string new_tracking_num,
double new_width, double new_height,double new_depth);
void set_dimension(double new_width, double new_height, double new_depth);
void get_dimensions(double &cur_width, double &cur_height, double &cur_depth);
double calc_shipping() const;
private:
double width, height, depth;
};
}
#include "Box.h"
#include <string>
using namespace std;
namespace shipping
{
Box::Box(): Package(),height(0),depth(0),width(0)
{
}
//my error comes here
Box(double new_weight, string new_tracking_num,
double new_width,double new_height,double new_depth):
Package(new_weight, new_tracking_num), height(new_height), depth(new_depth), width(new_width)
{
}
void Box::set_dimension(double new_width, double new_height, double new_depth)
{
width=new_width;
height=new_height;
depth=new_depth;
}
void Box::get_dimensions(double &cur_width, double &cur_height, double &cur_depth)
{
cur_width=width;
cur_height=height;
cur_depth=depth;
}
double calc_shipping() const{
double longest=width;
double girth=(height*2)+(2*depth);
if(height>longest)
{
longest=height;
girth=(width*2)+(2*depth);
}
if(depth>longest)
{
longest=depth;
girth=(height*2)+(2*width);
}
if(longest+girth>108)
{
return Package::cal_shipping()+30;
}
else
{
return Package::calc_shipping();
}
}
}