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: 3842016 • 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

Explanation / Answer

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

const int LEN=30;
class Customer{
   long int zipcode;
   char name[LEN];
   char address[LEN];
   char city[LEN];
   char state[LEN];
  
  
   public:
       void getData(){
           cout<<"Enter zip code"<<endl;
           cin>>zipcode;
           cout<<"Enter city"<<endl;
           cin>>city;
           cout<<"Enter state"<<endl;
           cin>>state;
           cout<<"Enter name"<<endl;
           cin.getline(name, LEN);
           cout<<"Enter address"<<endl;
           cin.getline(address, LEN);
          
           }
          
          
           void displayData(){
               cout<<name<<" ";
               cout<<address<<" ";
               cout<<city<<" ";
               cout<<state<<" ";
               cout<<zipcode<<" ";
              
   char date[10];
   _strdate(date);
   cout <<"Expected Arrival Date:"<<date << endl;
              
           }
          
};


class Package{
   public:
   int number;
   float overnightcost;
   float insurancecost;
   float totalcost;
   float discount;
   float shippingcost;
  
   virtual float totalcost()=0;//pure virtual function
  
     
   protected:
               virtual int getCase(){
                   return 0;                  
               }
  
  
};


class Videogames:public Package{
   overnightcost=4.99;
   float totalcost(){
       Videogames x;
       char ch;
       float cost;
      
       cout<<"enter number of video games";
       cin>>x.number;
       cout<<"do you want insurance";
       cin>>ch;
       if(ch=='y'){
           cost=(x.number*19.99)+4.99;
           x.insurancecost=cost*0.06;
           x.shippingcost=cost+   x.insurancecost;
           if(x.shippingcost<=200){
               x.discount=x.shippingcost*0.019;
               x.totalcost=x.shippingcost-x.discount;
           }
          
       else if(x.shippingcost>=200&&x.shippingcost<=500){
               x.discount=x.shippingcost*0.024;
               x.totalcost=x.shippingcost-x.discount;
           }
  
   else if(x.shippingcost>=500&&x.shippingcost<=1000){
               x.discount=x.shippingcost*0.028;
               x.totalcost=x.shippingcost-x.discount;
           }

else if(x.shippingcost>=1000){
               x.discount=x.shippingcost*0.033;
               x.totalcost=x.shippingcost-x.discount;
           }
          
          
                  
       }
       else{
          
           cost=(x.number*19.99)+4.99;
           x.shippingcost=cost;
           if(x.shippingcost<=200){
               x.discount=x.shippingcost*0.019;
               x.totalcost=x.shippingcost-x.discount;
           }
          
       else if(x.shippingcost>=200&&x.shippingcost<=500){
               x.discount=x.shippingcost*0.024;
               x.totalcost=x.shippingcost-discount;
           }
  
   else if(x.shippingcost>=500&&x.shippingcost<=1000){
               x.discount=x.shippingcost*0.028;
               x.totalcost=x.shippingcost-x.discount;
           }

else if(x.shippingcost>=1000){
               x.discount=x.shippingcost*0.033;
               x.totalcost=x.shippingcost-discount;
           }
          
       }
       cout<<number<<"video games ordered:"<<endl;
       cout<<"shipping cost is:"<<x.shippingcost<<endl;
       cout<<"overnight delivery is:"<<x.overnightcost<<endl;
       cout<<"shipping cost is:"<<x.shippingcost<<endl;
       cout<<"Total cost is:"<<x.totalcost<<endl;
       cout<<"shipping cost is:"<<x.shippingcost<<endl;
       cout<<"Discount is:"<<x.discount<<endl;
       cout<<"Total cost after discount is:"<<x.totalcost<<endl;  
      
      
   }
  
};

class GeniusPhones:public Package{
   overnightcost=25.00;
   float totalcost(){
       GeniusPhones y;
       char ch;
       float cost;
      
       cout<<"enter number of video games"
       cin>>y.number;
      
       int getCase(){
           return number;
       }
       cout<<"do you want insurance";
       cin>>ch;
       if(ch=='y'){
           cost=(y.number*699.99)+y.overnightcost+y.number*24.99;
           y.insurancecost=cost*0.11;
           y.shippingcost=cost+   y.insurancecost;
           if(y.shippingcost<=200){
               y.discount=y.shippingcost*0.019;
               y.totalcost=y.shippingcost-y.discount;
           }
          
       else if(y.shippingcost>=200&&y.shippingcost<=500){
               y.discount=y.shippingcost*0.024;
               y.totalcost=y.shippingcost-y.discount;
           }
  
   else if(y.shippingcost>=500&&y.shippingcost<=1000){
               y.discount=y.shippingcost*0.028;
               y.totalcost=y.shippingcost-y.discount;
           }

else if(y.shippingcost>=1000){
               y.discount=y.shippingcost*0.033;
               y.totalcost=y.shippingcost-y.discount;
           }
          
          
                  
       }
       else{
          
           cost=(y.number*699.99)+y.overnightcost+y.number*24.99;
           y.shippingcost=cost;
           if(y.shippingcost<=200){
               y.discount=y.shippingcost*0.019;
               y.totalcost=y.shippingcost-y.discount;
           }
          
       else if(y.shippingcost>=200&&y.shippingcost<=500){
               y.discount=y.shippingcost*0.024;
               y.totalcost=y.shippingcost-y.discount;
           }
  
   else if(y.shippingcost>=500&&y.shippingcost<=1000){
               y.discount=y.shippingcost*0.028;
               y.totalcost=y.shippingcost-y.discount;
           }

else if(y.shippingcost>=1000){
               y.discount=y.shippingcost*0.033;
               y.totalcost=y.shippingcost-y.discount;
           }
          
       }
       cout<<number<<"Genius Phones ordered:"<<endl;
       cout<<"shipping cost is:"<<y.shippingcost<<endl;
       cout<<"overnight delivery is:"<<y.overnightcost<<endl;
       cout<<"shipping cost is:"<<y.shippingcost<<endl;
       cout<<"Total cost is:"<<y.totalcost<<endl;
       cout<<"shipping cost is:"<<y.shippingcost<<endl;
       cout<<"Discount is:"<<y.discount<<endl;
       cout<<"Total cost after discount is:"<<y.totalcost<<endl;  
      
      
   }
  
};


class HotDogs:public Package{
   float condiments;
   float buns;
   char c, d;
   overnightcost=9.00;
   float totalcost(){
       HotDogs z;
       char ch;
       float cost;
      
       cout<<"enter number of video games"
       cin>>z.number;
       cout<<"do you want insurance";
       cin>>ch;
       if(ch=='y'){
           cout<<"do you want condiments";
           cin>>c;
           cout<<"do you want buns";
           cin>>d;
           if(c=='y' && d='y')
          
          
      
           cost=(z.number*5.99)+z.overnightcost+0.79*z.number+1.29*z.number;
           z.insurancecost=cost*0.03;
           z.shippingcost=cost+   z.insurancecost;
           if(z.shippingcost<=200){
               z.discount=z.shippingcost*0.019;
               z.totalcost=z.shippingcost-z.discount;
           }
          
       else if(z.shippingcost>=200&&z.shippingcost<=500){
               z.discount=z.shippingcost*0.024;
               z.totalcost=z.shippingcost-z.discount;
           }
  
   else if(z.shippingcost>=500&&z.shippingcost<=1000){
               z.discount=z.shippingcost*0.028;
               z.totalcost=z.shippingcost-z.discount;
           }

else if(z.shippingcost>=1000){
               z.discount=z.shippingcost*0.033;
               z.totalcost=z.shippingcost-z.discount;
           }
          
          
                  
       }
       else{
          
           cost=z.number*5.99+z.overnightcost;
           z.shippingcost=cost;
           if(z.shippingcost<=200){
               z.discount=z.shippingcost*0.019;
               z.totalcost=z.shippingcost-z.discount;
           }
          
       else if(z.shippingcost>=200&&z.shippingcost<=500){
               z.discount=z.shippingcost*0.024;
               z.totalcost=z.shippingcost-z.discount;
           }
  
   else if(z.shippingcost>=500&&z.shippingcost<=1000){
               z.discount=z.shippingcost*0.028;
               z.totalcost=z.shippingcost-z.discount;
           }

else if(z.shippingcost>=1000){
               z.discount=z.shippingcost*0.033;
               z.totalcost=z.shippingcost-z.discount;
           }
          
       }
       cout<<number<<"Hot Dogs ordered:"<<endl;
       cout<<"shipping cost is:"<<z.shippingcost<<endl;
       cout<<"overnight delivery is:"<<z.overnightcost<<endl;
       cout<<"shipping cost is:"<<z.shippingcost<<endl;
       cout<<"Total cost is:"<<z.totalcost<<endl;
       cout<<"shipping cost is:"<<z.shippingcost<<endl;
       cout<<"Discount is:"<<z.discount<<endl;
       cout<<"Total cost after discount is:"<<z.totalcost<<endl;  
      
      
   }
  
};

class HotDogs:public Package{
   float condiments;
   float buns;
   char c, d;
   overnightcost=9.00;
   float totalcost(){
       char ch;
       float cost;
      
       cout<<"enter number of video games"
       cin>>number;
       cout<<"do you want insurance";
       cin>>ch;
       if(ch=='y'){
           cout<<"do you want condiments";
           cin>>c;
           cout<<"do you want buns";
           cin>>d;
           if(c=='y' && d='y')
          
          
      
           cost=(number*5.99)+overnightcost+0.79*number+1.29*number;
           insurancecost=cost*0.03;
           shippingcost=cost+   insurancecost;
           if(shippingcost<=200){
               discount=shippingcost*0.019;
               totalcost=shippingcost-discount;
           }
          
       else if(shippingcost>=200&&shippingcost<=500){
               discount=shippingcost*0.024;
               totalcost=shippingcost-discount;
           }
  
   else if(shippingcost>=500&&shippingcost<=1000){
               discount=shippingcost*0.028;
               totalcost=shippingcost-discount;
           }

else if(shippingcost>=1000){
               discount=shippingcost*0.033;
               totalcost=shippingcost-discount;
           }
          
          
                  
       }
       else{
          
           cost=number*5.99+overnightcost;
           shippingcost=cost;
           if(shippingcost<=200){
               discount=shippingcost*0.019;
               totalcost=shippingcost-discount;
           }
          
       else if(shippingcost>=200&&shippingcost<=500){
               discount=shippingcost*0.024;
               totalcost=shippingcost-discount;
           }
  
   else if(shippingcost>=500&&shippingcost<=1000){
               discount=shippingcost*0.028;
               totalcost=shippingcost-discount;
           }

else if(shippingcost>=1000){
               discount=shippingcost*0.033;
               totalcost=shippingcost-discount;
           }
          
       }
       cout<<number<<"Hot Dogs ordered:"<<endl;
       cout<<"shipping cost is:"<<shippingcost<<endl;
       cout<<"overnight delivery is:"<<overnightcost<<endl;
       cout<<"shipping cost is:"<<shippingcost<<endl;
       cout<<"Total cost is:"<<totalcost<<endl;
       cout<<"shipping cost is:"<<shippingcost<<endl;
       cout<<"Discount is:"<<discount<<endl;
       cout<<"Total cost after discount is:"<<totalcost<<endl;  
      
      
   }
  
};


int main(){
   char choice[50];
   cout<<"Choice Menu"<<endl;
   cout<<"1. Video games"<<endl;
   cout<<"2. Genius phones"<<endl;
   cout<<"3. Hot Dogs"<<endl;
  
   cout<<"enter your choice";
   cin>>choice;
  
      
   switch(choice){
       case 1:
       Videogames v;
       v.totalcost();
       break;
      
      
       case 2:
       GeniusPhones g;
       g.totalcost();
       break;
      
       case 3:
       HotDogs h;
       h.totalcost();
       break;
      
           default:
               cout<<"wrong choice";
               break;
   }
  
  
   return 0;
}

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