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

This program should calculate package shipping costs. The shiping company has th

ID: 3838834 • Letter: T

Question

This program should calculate package shipping costs. The shiping company has the following discount percentages.

Shipping Costs:                                       Discount %:

$200 or less                                                 1.9%

$200.01 to $500                                           2.4%

$500.01 to $1000                                         2.8%

$1000.01 or more                                         3.3%

Package Types Shipping Costs:

1. Video games: Cost is number of video games * $19.99 per video game. For overnight delivery, add $4.99. Optional insurance is 6% of the cost.

2. Genius Phones: Cost is number of genius phones * $699.99 per genius phone. For optional overnight delivery add $25.00. If a genius phone case is needed, add $24.99 per genius phone. The number of of genius phones requiring the genius phone case should be passed to the appropriate method. Optional insurance is 11% of the cost.

3. Hot Dogs: cost is number of hot dogs * $5.99 per hot dog. For optional overnight delivery, add $9.00. If condiments are needed, add $0.79 per hot dog for the condiments. If hot dog buns are to be ordered, an additional charge of $1.29 per hot dog is required. Optional insurance is 3% of the cost.

4. A package type of your choice: Please include documentation (comment statements) stating how the costs should be calculated for your package type.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

For each package type, print out the names, address, city, state, and zip code for the customer. in addition, print out the date the package is expected to arrive along with the total cost with how the calculation was done, the discount percentage, and the total cost after the dicount is subtracted off. Please make sure to include output for each of the four package types.

Your program should use virtual functions including at least one pure virtual function with polymorphism. Your program should have one class for each package type along with a base-class that contains the appropriate data members and methods. An example of sample output for video games could be:

Ex:

Customer: Joe Blow                                                 Expected Arrival Date: 3-25-2017

                 1234 Main Street

                  Irvine, CA 92618

4 video games ordered: shipping cost is $79.96, overnight delivery is $4.99, no insurance specified

Total Cost is $84.95

Discount percentage is 1.9% for a discount of $1.61

Total Cost after discount is $83.34

Program so far:

#define _crt_secure_no_warnings
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;


class order
{

public:

order(const char*, const char, const char);

~order;
{

  delete[] first;

     delete[] last;

  delete[] address;

}

virtual float shippingCost() const = 0;
virtual float totcost() const = 0;
virtual void print() const = 0;


private:

char *first; char *last; char *address;


};

order::order(const char *f, const char *u, const char *i) {

first = new char[strlen(f) + 1];
strcpy(first, f);

last = new char[strlen(u) + 1];
strcpy(last, u);

address = new char[strlen(i) + 1];
strcpy(address, i);

}

Explanation / Answer

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

class order
{
   protected:
   char *first; char *last; char *address;

   public:
   //order(const char*, const char*, const char*);
   ~order(){
delete[] first;
delete[] last;
   delete[] address;
};

   //virtual float shippingCost() const = 0;
   //virtual float totcost() const = 0;
   //virtual void print() const = 0;
};

/*order::order(const char *f, const char *u, const char *i) {
first = new char[strlen(f) + 1];
strcpy(first, f);
last = new char[strlen(u) + 1];
strcpy(last, u);
address = new char[strlen(i) + 1];
strcpy(address, i);
}*/

class VideoGames: public order {

   private:
       double gameCost;
       double deliveryCharges ;
       double optionalInsurence;
       bool isInsurenceAvil;
   public:
   VideoGames(){
   gameCost = 19.99;
   deliveryCharges = 4.99;
   optionalInsurence = 6;
   isInsurenceAvil = false;
   }
     
   void intializeCustomer(const char *f, const char *u, const char *i) {
first = new char[strlen(f) + 1];
strcpy(first, f);
last = new char[strlen(u) + 1];
strcpy(last, u);
address = new char[strlen(i) + 1];
strcpy(address, i);
}
};


int main(){

   char firstName[30] = {''};
   char address[30] = {''};
   char city[30] = {''};
   char state[30] = {''};
   int zipcode;

   cout<< " Enter name";
   cin >> firstName;

   cout << " enter address";
   cin >> address;
  
   cout << " enter city ";
   cin >> city;

   cout << " enter state ";
   cin >> state;

   cout << " enter zip code ";
   cin >> zipcode;

   cout << firstName << address << zipcode << endl;
  
  
  
return 1;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote