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

  Program that allows a user to input coordinates

In Java make a program that allows a user to input coordinates as to make a Hexagon via an array, and my professor has set the standards of: Write a class Polygon which draws a hexagon for a set of numbers given by the user.

  Write a program that asks a user for a file name and prints

Write a program that asks a user for a file name and prints the number of characters, words, and lines in that file.

  Write a recursive method to produce a pattern

Write a recursive method to produce a pattern of n lines of asterisks.

  Utilizes a good design process

Analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call and the use of at least one array.

  Create a java class called samearraysexception

Create a Java class called SameArraysException that extends the Exception class.

  Simple java application that uses the string

Create a simple Java application that uses the String class and/or the StringBuffer class and at least 4 of the class methods. Show the code, demonstrate it works properly and describe what it is doing.

  Create system in java using agile approach

You are a software manager in company which designs critical control software for aircraft. Create system in Java using agile approach with a user involved in the development team.

  Three most primary forms of loops: the while loop, the do..

explored the world of loops we have accepted the three most primary forms of loops: the while loop, the do...while loop (even though Python does not use this loop), and the for loop. The for loop has approximately three primary implementations that w..

  Write a complete java program assuming that the variables gp

Write a complete java program Assuming that the variables gpa, deanList and studentName have been declared, you should read in the studentName and gpa from keyboard. Write an if statement that adds 1 to deansList and prints studentName to the standar..

  Create a web application for sheridan restaurant

Create a web application for Sheridan Restaurant Reviews that contains the following functionality - Display a table of all restaurants based on the city entered by the user

  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.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

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