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

  Method called printpowersof2 that accepts a maximum number

Write a method called printPowersOf2 that accepts a maximum number as an argument and prints each power of 2 from 20 (1) up to that maximum power, inclusive. For example, consider the following calls: printPowersOf2(3); printPowersOf2(10)

  Develop java package comprising of class using encapsulation

Develop the Java package comprising of Class and Student with the given requirements. Encapsulation, Method to print student details alone.

  Create a recursive factorial program

Assignment 1: 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 !. For example, if the input is 4, the output could be:

  Define a class called counter

Define a class called Counter. An object of this class is used to count things, so it records a count that is a non negative whole number. Include methods to set the counter to 0, to increase the count by

  Create a world class that contains a 2d array

You have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the time.

  Which drags html list items to and from a javascript array

Write a program which drags html list items to and from a javascript array.

  Java project

Prompt the user for an int between lower and upper boundary.

  What is overloading and what is overriding

What is overloading and what is overriding? Please use code to explain it.

  Write a program in java that simulates a simple line editor

Write a program in Java that simulates a simple line editor which supports the following operations

  The data file being used contains records

The data file being used contains records with an employee's name, the number of hours they worked, and their hourly pay rate. Write a program to read the records of information and output (to the Output window or a dialog box) the employee's name..

  Write applet which reads five numbers-draw equivalent stars

Write the applet which reads five numbers (each between 1 and 30). For each number read, your program must design line containing that number of adjacent asterisks.

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