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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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