Write a Subclass and Total It Through the Abstract Type
mediumQuestion 551Order is an abstract class with a protected subtotal and an abstract method total(). Write one concrete subclass, and a method that adds up orders through the abstract type.
Requirements:
1. DeliveryOrder extends Order. Its public constructor DeliveryOrder(double subtotal) passes the subtotal to the Order constructor.
2. total() in DeliveryOrder returns the subtotal plus a delivery fee of 4.99.
3. Till has a method public static double sum(Order[] orders) that returns the sum of total() over every order in the array, and 0.0 for an empty array.
4. sum must call total() on each element. The tests add their own subclass, PickupOrder, whose total() is just the subtotal, so do not test for DeliveryOrder inside the loop.
5. Till is the public class. Keep DeliveryOrder without the word public.
Do not change the Order class.
Do NOT write a main method.
Expected output
24.99 47.48
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...