Data member and functions

Assignment Help Basic Computer Science
Reference no: EM132270095

Your family runs a package delivery services which offer a number of different shipping options, each with specific costs associated. Make an inheritance hierarchy to represent various types of packages. Use Package (standard package) as the base class of the hierarchy, and then add two derived classes TwoDayPackage and OvernightPackage. In the base class (Package), it includes sender and recipient information, package weight in ounces and cost per ounce. Package class has a function calcCost() which allows derived classes to override with their own implementations. Derived class TwoDayPackage should inherit the functionality from base class, Package, but also includes its own data member that represents a flat fee for two day delivery services. OvernightPackage class inherits from Package class and also includes a fee which charges extra fee per ounce for overnight delivery services. Both classes will override the calcCost() and print() functions from the base class. Your program should contain the following functionality:

a. Make a base class named Package which has the following private data members 

  • weightInOuncewith double type
  • costPerOuncewith double type
  • senderNamewith string type
  • senderZipwith string type
  • recipientNamewith string type
  • recipientZipwith string type

a. Package class should contain the following functions: 

  • constructor which initializes the private data members
  • parameterized constructor to set the value for each private data members
  • necessary get and set functions for each private data members
  • double calcCost()- returns the cost of the package (weightInOunce*costPerOunce)
  • void print()- displays the package information including type of package, sender, recipient, weight, and cost.[NOTE: use virtual function in order to be able to derive from this class]

a. Make a derived class named TwoDayPackage which inherits the functionality from based class, Package, but also include its own data member and functions. 

  • flatFeewith double type
  • add necessary constructors and get and set functions forflatFee

a. Make a derived class named OvernightPackage which inherits from Package and also includes its own data member and functions.

  • extraFeePerOuncewith double type
  • add necessary constructors and get and set functions forextraFeePerOunce

a. Both derived classes will override the calcCost() and print() functions from the base class.

b. In your main program, Make an array of Package which holds a list of 5 packages. const int SIZE=5;

Package pkgList[SIZE]; [NOTE: recommend to use array of pointers to make it easier to manage derived classes]

c. Fill the pkgList array with each type of the package (3 TwoDayPackages and 2 OvernightPackages).

d. Display the package list with details of each package.

Reference no: EM132270095

Questions Cloud

How will your research add to the knowledge base : How does the goal of your study address the research problem and how will your proposed study offer promise as a resolution to the problem?
Python program that can authenticate the administrator : Is there help for this question: Mary is the lab administrator. Mary's password is '1234'. is there a Python program that can authenticate the administrator:
At least one group member gets a grade of a : Is there any help for this question: Two students Alice and Bob are paired up as a group. is there a python program that allows the input of their grades
Issue of scalability in ospf multi-access network : How was DR and BDR were able to solve the issue of scalability in OSPF multi-access network.
Data member and functions : Make a derived class named TwoDayPackage which inherits the functionality from based class, Package, but also include its own data member and functions.
An extended explanation of how you view an idea : A definition essay is an extended explanation of how you view an idea, concept, activity, or word.
Program that reads a local election result file : C++ program that reads a local election result file (called "votes.txt"):
Introduce the Environmental Hazard - Air Pollution : Submit a draft of your introduction to the environmental hazard you have selected. Environmental Hazard: Air Pollution
Options for computers that do not support pxe boot : What are the options for computers that do not support PXE boot?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  How can a price ceiling on tickets lead to scalping

How can a price ceiling on tickets lead to scalping? Is price an effective rationing mechanism under a binding price ceiling? Why or why not?

  Family-of-computers idea

The family-of-computers idea was introduced in the 1960s with the IBM System/360 mainframes. Is this idea now dead as a doornail or does it live on?

  What percentage of yearly returns are at or above below

You are allowed to use Excel. What percentage of yearly returns are at or above below the 10th percentile?"

  Genetically modified seeds

Bio Foods Inc. offers free genetically modified seeds (GMS) to farmers in developing countries during the first season

  Calculate an effect size as well as post hoc power

Calculate an effect size as well as post hoc power. Then write an APA-style paragraph reporting your results.

  What are the agents in your model

How would you simulate the different policy choices, namely, the allocation of funds to minimize commuter time? What measures would you collect to answer the council ' s question?

  Write a static recursive method that returns sum of integers

Write a static recursive method that returns the sum of the integers in the array of int values passed to it as a single argument.

  Exception of type parseexception as a try block

Organize the code capable of throwing an exception of type ParseException as a try block.

  Current healthcare administrative problems

Example of public health implications and what are current healthcare administrative problems?

  What does the hash table look like

what does the hash table look like after the following insertions occur: 8, 10, 24, 15, 32, 17? Assume that each item contains only a search key.

  Paper that reviews max weber theories

Write a 3-4 page paper that reviews Max Weber's theories and arguments to explain a recent social event (i.e., Occupy movement, local high-profile event). Does his theory hold up under modern scrutiny? Why or why not? Support your response.

  Advantages and disadvantages of compilers and interpreters

Discuss the advantages and disadvantages of compilers and interpreters. When would you use each? Pick a problematic that you think a Java can solve or make easier.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd