It inherits the functionality of super class

Assignment Help JAVA Programming
Reference no: EM13167065

Package-delivery services, such as FedEx, DHL and UPS, offer a number of different shipping options, each with specific costs associated.

Create an inheritance hierarchy containing super class Package and subclasses RegularPackage, TwoDayPackage and OvernightPackage.

a.       Super class Package.java

-            It includes data members representing the package id, first and last name for both the sender and the recipient of the package (in fact, address, city, state and ZIP code for both the sender and the recipient should be included).

-            It includes data members that store the weight (in ounces) and cost per ounce to ship the package.

-            Package's constructors should initialize these data members. Ensure that the weight and cost per ounce contain positive values.

-            Package should provide an abstract public method calculateCost() that is supposed to return a double indicating the cost associated with shipping the package.

-            (Don't forget to include toString, accessors, and mutators).

b.      Subclass RegularPackage.java

-            It inherits the functionality of super Package, but also includes an additional data member that represents a rate that the shipping company uses for calculating the cost of regular package.

-            The constructors should initialize data members. Ensure that the rate is validated before being set.

-            It should override calculateCost() method so that it computes the shipping cost by multiplying the rate with the weight-based cost.

c.       Subclass TwoDayPackage.java

-            It inherits the functionality of super class Package, but also includes a data member that represents a flat fee that the shipping company charges for two-day delivery service.

-            The constructors should initialize all data members. Ensure that the flat fee is validated before being set.

-            It should override method calculateCost() so that it computes the shipping cost by adding the flat fee to the weight-based cost.

d.      Subclass OvernightPackage.java

-            It inherits the functionality of super class Package and contains an additional data member representing an additional fee per ounce charged for overnight-delivery service.

-            The constructors should initialize data members. Ensure that the fee is validated before being set.

-            It should override method calculateCost() so that it adds the additional fee per ounce to the standard cost per ounce before calculating the shipping cost.

e.       Write a client program that simulates a package delivery system.

-            The program should contain an array of Package to hold variety of objects of RegularPackage, TwoDayPackage and OvernightPackage.

-            It loops through the array to process the packages polymorphically.

-            It should be menu-driven, use a menu to do the following.

1: To create a regular package object and put it into the array of Package.

2: To create a two-day package object and put it into the array of Package.

3: To create an overnight package object and put it into the array of Package.

4: To display a report that shows all the packages' information in the array using polymorphism.

5: To display the total shipping cost for all the packages in the array.

                          0: To end program

Reference no: EM13167065

Questions Cloud

Using notepad that implements a basic text analyzer : Write a Java application using Notepad that implements a basic Text Analyzer.
Time consuming phase of the data warehousing project : Proper design and implementation of the ETL process is crucial to a BI project. ETL is considered the most time consuming phase of the Data Warehousing project. Therefore, anything that might go wrong with this process will significantly affect the s..
Explain where the following method invocations : Explain where the following method invocations are most likely to be found in a program for dealing with census data organized using the Model, View, Controller (MVC) design pattern. Choices are zero or more of Model, View, and Controller. Be sure to..
Mips instructions into machine instructions in hexadecimal : Convert the following MIPS instructions into machine instructions in hexadecimal form
It inherits the functionality of super class : It inherits the functionality of super class Package and contains an additional data member representing an additional fee per ounce charged for overnight-delivery service.
Give a recursive algorithm for finding the number of one''s : Give a recursive algorithm for finding the number of one's in a bit string, name the algorothm count-ones.
Give an example of an exception : A. Give an example of an exception that could be generated outside your code but caught within your code
Statement to display the sku, sku_description : write an sql statement to display the SKU, SKU_Description, WareHouse ID, and QuantityOnHand for all products having a QuantityOnOrder equal to 0. Sort the results in descending order by WareHouse ID and in ascending order by SKU
Explain where the following method invocations : Explain where the following method invocations are most likely to be found in a program for dealing with census data organized using the Model, View, Controller (MVC) design pattern. Choices are zero or more of Model, View, and Controller. Be sure to..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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