Question: Create a Delivery class for a delivery service. The class contains fields to hold the following: A delivery number that contains eight digits. The first

Create a Delivery class for a delivery service. The class contains fields to hold the following: A delivery number that contains eight digits. The first four digits represent the year, and the last four digits represent the delivery number. For example, the 76th delivery in 2011 has a complete delivery number of 20110076. A code representing the delivery area. A local delivery is code 1, and a long-distance delivery is code 2. A weight, in pounds, of the item to be delivered. The fee for the delivery, as follows: Distance Weight Fee ($) 1 Under 5 pounds 12.00 1 5 to 20 pounds 16.50 1 Over 20 pounds 22.00 2 Under 5 pounds 35.00 2 5 pounds or more 47.95 Create a constructor for the Delivery class that accepts arguments for the year, delivery number within the year, delivery distance code, and weight of the package. The constructor determines the eight-digit delivery number and delivery fee. Also include a method that displays every Delivery object field. Save the file as Delivery.java.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!