Problem

Create a Delivery class for a delivery service. The class contains fields to hold the fo...

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, 61f the item to be delivered.

• The fee for the delivery, as follows:

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.

Next, create an application that prompts the user for data for a delivery. Keep prompting the user for each of the following values until they are valid:

• A four-digit year between 2001 and 2025 inclusive

• A delivery number for the year between 1 and 9999 inclusive

• A package weight between 0.10 pound and 100 pounds inclusive

• A delivery distance code that is either 1 or 2 When all the data entries are valid, construct a Del i very object, and then display its values. Save the file as CreateDelivery.java.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT