1
I’m having trouble understanding the diagram and specifications below.
How I do the method double getCalculaFrete()
return the same value returned by the method double calcularFretePedido()
, being called by the variable calculaFrete
in class Pedido
, that is to say, calculaFrete.calcularFretePedido()
.
And every concrete class that inherits from the abstract class CalcularFrete
should return a value double
for the value of your freight. An example would be, a standard freight costs R $ 3,50 and an express freight costs R $ 5,50.
Create two objects to test this program in the Main class. In order for the test to be done correctly, the objects need to be of the type of the Order class and to show the freight value of each one just access the double getCalculaFrete() method of that same object, ie, whereas an object was created with the following name Application requested 1... , to show the value of your freight just trigger the return so requested 1.getCalculaFrete() and print it. Thanks to polymorphism, the Request class constructor receives any object from a given class that has a "is one" relationship with the abstract class.
I’m having trouble printing it too... Help...
Thank you!