Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(b) Write a class encapsulating the concept of a package, called Package, which

ID: 3908889 • Letter: #

Question

(b) Write a class encapsulating the concept of a package, called Package, which contains instance variables for TrackinglD, Weight (in ounces), Cost, shipMethod, and Destination. shipMethod is a variable of an enumerated type called Shipping, which defines the following constants for a shipping method {Air, Ground, Seat. Destination is a reference to an object of the Address class The Package class includes the following: » A constructor that accepts arguments for the weight, and shipping method. The constructor calls a method called calculateCost) to determine the shipping cost. The calculateCost) method computes the cost of a package delivery based on the method of shipping. The shipping cost is determined based on the following table: . Weight (ounces)Air Ground Sea 1-8 9-16 17 and over 4.00 6.00 9.00 1.80 2.80 4.00 0.55 1.50 2.00 * Accessesor, mutator methods for the Weight, shipMethod, and Destination instance variables. The mutator methods for the Weight and shipMethod should call the calculateCost) method in order to recalculate the package cost. A method, called GeneratelD, that accepts a Random class object which is used to generate and set the TrackinglID by a random number of 6 digits, then returns its value. * * toString) method that returns a nicely formatted string of the package information

Explanation / Answer

Put this is Package.java.

thanks!