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

  Fixing errors in a java program

You coded the following on line ten of the class MyApplet.java:

  The reference to the abstract class

Explain what happens when the reference to the abstract class X is used to execute method M1( ). X obj = new Y( ); obj.M1( );

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Write java program to reads ten values from user

Write the java program which reads 10 values from user and store them in 1 daimantion array. your program will ask the user wich operation he wants to perform:

  Implement 4 sorting algorithms in a java "sort" class.

Implement 4 sorting algorithms in a Java " Sort " class. ( insertion sort, selection sort and quicksort, and mergesort). count the number of comparisons made.

  Write a program to track hourly employee arrival departure

THE JAVA SOURCE CODEWILL AWARD AN ADDITIONAL 1,500 POINTS TO PERSON WITH THE BEST ANSWER (you will be directed to another one of my previous, unanswered questions.)A company hires you to write a program to track hourly employee arrival and departure ..

  Java program that asks the user for 100 values

Write a Java program that asks the user for 100 values (or generates these randomly) and stores and displays only the distinct values. Hint: use an array to store and display these values.

  Web application that allows user to specify six lottery nums

Write a web application that allows a user to specify six lottery numbers. Generate your own combination on the server, and then print out both combinations together with a count of matches.

  The objective is to implement a menu-based system

The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

  Program that simulates the rolling of a single die1000 times

Write a program that simulates the rolling of a single die 1000 times. The program must use an array of size 6 and not 1000 to store the occurrences of each side or face on the six-sided die. The program should output the particular die face and the ..

  Algorithm analysis with advanced data structures

Write a program to help the merchants devise a sequence of transmutations that would change silver into gold with the smallest possible total fee paid to the alchemists.

  Create a book class

Create a Book class. In addition to properties of author and isbn, with setters/getters, the Book should override Object's base method "boolean equals(Object)" and have a "boolean validate()" method.

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