Menu

(Solved) : Partially Completed Need Help Using Runnable Executionservice Prompt Create Order Class Re Q37892864 . . .

Partially completed, need help using Runnable andExecutionService

Prompt:

  1. Create an “Order” class to represent an incoming order with thefollowing fields

    1. Customer Name

    2. Customer Address

    3. Pounds of honey

  2. Create a list to hold incoming orders and populate it withat least 6 orders

  3. Create an ExecutorService instance to managethreads

  4. Write a Runnable class to process each order by callingthe API to generate a shipping label

    1. “Print” each label by printing it to theconsole

      1. Although ShippingLabel does have a toString() method, itis not very readable. Print the shipping label in a moreuser-friendly way.

      2. Watch out for concurrency problems!

    2. Keep track of the total cost of allshipments

      1. There are many ways to do this – use any mechanism youlike, but make sure that you account for any possible raceconditions

  5. Cleanly shutdown the ExecutorService

  6. Print the total cost after all orders have beenfilled

FINISHED STEP 1 AND 2… SCREENSHOTS BELOW. PLEASE HELP WITHREMAINING STEPS WITH THE FOLLOWING INFO:

package shipping public class runOrder implements Runnablet @override public void run) runOrderrun

order orderb new Orderc X,X,10: ShippingService shippingService new ShippingService(); ShippingLabel sLabel1 = shippingSer

package shipping public class runOrder implements Runnablet @override public void run) runOrderrun order orderb new Orderc “X”,”X,10: ShippingService shippingService new ShippingService(); ShippingLabel sLabel1 = shippingService.getShippingLabel ( order1.getCustomerName(), orderi . getCustomerAd ShippingLabel sLabel2 shippingService.getShippingLabel(order2 . getCustome rName(), order2 . getCustomerAd ShippingLabel sLabel3 shippingService.getShippingLabel (orde r3.getCustomerName(), order3.getCustomerAd ShippingLabel sLabel4 -shippingService.getShippingLabel(order4.getCustomerName ), order4.getCustomerAd ShippingLabel sLabel5shippingService.getShippingLabel(order5.getCustomerName(), order5.getCustomerAd ShippingLabel sLabel6shippingService.getShippingLabel(order6.getCustomerName(), order6.getCustomerAd ArrayList<object> shippingLabel -new ArrayList; shippingLabel.add(sLabel1); shippingLabel.add(sLabe12); shippingLabel.add (sLabeL3); shippingLabel.add(sLabel4); shippingLabel.add(sLabel5); shippingLabel.add(sLabel6); for (Object label: shippingLabel) Show transcribed image text

Expert Answer


Answer to Partially Completed Need Help Using Runnable Executionservice Prompt Create Order Class Re Q37892864 . . .

OR