Create a class named package with data fields for weight

Assignment Help Computer Engineering
Reference no: EM13322409

Create a class named Package with data fields for weight in ounces (oz.), shipping method, and shipping cost.

The shipping method is a character: ‘A' for air, ‘T' for truck, or ‘M' for mail.

The package class contains a constructor that requires arguments for weight and shipping method.

The constructor calls a calculateCost() method that determines the shipping cost based on the following table:


Weight (oz.) Air Truck Mail
1 to 8 2.00 1.50 0.50
9 to 16 3.00 2.35 1.50
17 and over 4.50 3.25 2.15

The package class also contains a display() method that displays the values in all four fields. Create a subclass named InsuredPackage that adds an insurance cost to the shipping cost based on the following table:

Shipping cost before insurance Additional cost ($)
0 to 1.00 2.45
1.01 to 3.00 3.95
3.01 and over 5.55


Write an application named UsePackage that instantiates at least three objects of each type (Package and InsuredPackage) using a variety of weights and shipping method codes.

Display the results for each Package and InsuredPackage.

Save the files as Package.java, InsuredPackage.java, and UsePackage.java.

 

Reference no: EM13322409

Questions Cloud

Find the minimum and maximum possible values of wavelength : Light passes through a 200 line/mm diffraction grating and is observed on a 1.0 m-wide screen located 1.0 m behind the grating. What are the minimum and maximum possible values of wavelength
Determine diameter of rod if it has to be subjected to load : A rod of copper alloy 50 inches long has a modulus of elasticity of 16*10^7 psi. If the maximum allowable elongation is 0.05 in, determine the diameter of the rod if it has to be subjected to a load of 3200 lb.
Standard deviation and capm beta estimates : Standard  deviation and capm beta estimates
Where is the image of your nose located : Examining your imange in a convex mirror whose radius of curvature is 24.6cm, Where is the image of your nose located
Create a class named package with data fields for weight : Create a class named Package with data fields for weight in ounces (oz.), shipping method, and shipping cost.
Explain the addition of bromine to ethene in the presence : The addition of bromine to ethene in the presence of high concentration of chloride ion in an inert solvent results in the formation of 1,2-dibromoethane and 1-bromo-2-chloroethane.
Use to assess domestic risk in an effective manner : Use to assess domestic risk in an effective manner?
Prepare an opening statement that specifies organization : The graphically depicted solution is not included in the required page length. Explain what the client can expect from your services.
What are the current limitations : Explain what are the priorities: more charges or more energy stored in batteries used to propel cars or even light planes. What are the current limitations

Reviews

Write a Review

Computer Engineering Questions & Answers

  By testing example with different values for the inputs

The customers should come in at a steady rate by z number of seconds. There must be a max of customers that may come in as w.

  Write down the largest and the smallest numbers to screen

Write down a Java program that will search a text file of strings representing numbers of type int and will write the largest and the smallest numbers to the screen.

  Describing the lcg

Provide the value of a? Specify the restrictions that are required on the seed?

  How insightful is the experimental analysis with the planner

How insightful is the experimental analysis with the planner (how easily the planner solves the instances, how well the planner scales up as the instances are made larger or more complex, how well the results are reported: times, qualityof solutio..

  Cityquery and productquery

Create a report by the city and another by the product, involving details of sales and sub-totals and totals for the quantity.

  Challenges in delivering products -information over internet

One of the biggest challenges linked with the delivering products and information over Internet is the ease with which the others can infringe on other's rights. Provide some examples of this.

  Create the table relationships

make one query, your choice. Remember a query answers a question. As an example, list all household electronics that are greater in value than $200. Please ensure that the query title reflects what the query is about.

  Implementing the program for carrying out the calculation

Write down a program that has a function named presentValue which carry out this calculation. The function must accept the future value, annual interest rate, and number of years as arguments.

  Define testing and debugging in terms of run time

define in your own words the difference between testing and debugging.

  Programming field as career

Unfortunately, there are fewer women within the programming fields that there are men, encourage women to go into these fields

  Recognize how to locate fsmo roles

Recognize how to locate FSMO roles?

  What is equation in java

What is equation in Java

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