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

// I need to have one constructor with no arguements and another constructor wit

ID: 3644601 • Letter: #

Question

// I need to have one constructor with no arguements and another constructor with
// with tow arguements taxrate and price perinch assigns them to the appropriate member variables:

//then have five set fuctions for each member varriable and five get functions as well
/*then have three member functions: calcSubtotal Member Function:
o This member function should calculate the price of the gift wrap BEFORE tax. The price of the gift wrap before tax is calculated as follows:
1. First calculate the surface area of the box.
o Surface Area = (2 * length * width) + (2 * length * height) + (2 * width * height)
2. Next multiply the surface area of the box by the price per inch. This is the subtotal for the gift wrap.

Explanation / Answer

Please rate...

giftWrap.h

==================================================================

#ifndef E
#define E

#include <iostream>
#include <string.h>
using namespace std;


class giftwrap
{
public:
giftwrap (double, double);
giftwrap ();
void setLength(int l){length=l;}
void setWidth(int w){width=w;}
void setHeight(int h){height=h;}
void setTaxRate(double tr){taxRate=tr;}
void setPricePerInch(double pi){pricePerInch=pi;}
void setNameOfStore(char a[]){strcpy(nameofStore,a);}

int getLength(){return length;}
int getWidth(){return width;}
int getHeight(){return height;}
double getTaxRate(){return taxRate;}
double getPricePerInch(){return pricePerInch;}
char* getNameOfStore(){return nameofStore;}

double calcSubtotal();
double calcTax();
double calcTotal();

private:
int length;
int width;
int height;
double taxRate;
double pricePerInch;
char nameofStore[100];
};

#endif

==============================================================================

giftWrap.cpp

==============================================================================

#include <iostream>
#include <iomanip>
#include "giftWrap.h"

using namespace std;
giftwrap::giftwrap()
{
    int i;
    length=0;
    width=0;
    height=0;
    taxRate=0;
    pricePerInch=0;
    for(i=0;i<100;i++)
    {
        nameofStore[i]='';
    }
}
giftwrap::giftwrap(double a,double b)
{
    taxRate=a;
    pricePerInch=b;
}
double giftwrap::calcSubtotal()
{
    int surfaceArea=(2*length*width)+(2*length*height)+(2*width*height);
    double bt=surfaceArea*pricePerInch;
    return bt;
}
double giftwrap::calcTax()
{
    double t=taxRate*(double)calcSubtotal();
    return t;
}
double giftwrap::calcTotal()
{
    double tot=calcTax()+(double)calcSubtotal();
    return tot;
}

========================================================================

giftWrapTest.cpp

========================================================================

#include <iostream>
#include <iomanip>
#include<stdlib.h>
#include "giftWrap.h"
#include "giftWrap.cpp";
int main()
{
    char a;
cout << "GIFT WRAP INVOICE GENERATOR ";
cout << "---------------------------- ";
cout << "a)Generate Gift Wrap Invoice ";
cout << "q)Quit ";
cin>>a;
giftwrap gw;
if(a=='q')exit(1);
gw.setHeight(10);
gw.setWidth(5);
gw.setLength(12);
gw.setTaxRate(4);
gw.setPricePerInch(2);
gw.setNameOfStore("Gift Store");
gw.calcTotal();

cout << "GIFT WEAP INVOICE - Sally Gifts ";
cout << "-------------------------------- ";
cout << "Box Length: " <<gw.getLength()<< " ";
cout << "Box Width: " <<gw.getWidth()<< " ";
cout << "Box Height: " <<gw.getHeight()<< " ";
cout << "SUBTOTAL: " << setw(3) <<gw.calcSubtotal()<< " ";
cout << "TAX: " << setw(3) <<gw.calcTax()<< " ";
cout << setw(6) << "--------- ";
cout << "TOTAL:" << setw(4) <<gw.calcTotal()<< " ";
system("PAUSE");
return 0;
}