LAB-1027, 1.2 Build MyOnlineShopUsingAbstractClass program, abstract mehtod defined in the Product is not implemented in extended class Electoronics

17 views
Skip to first unread message

Joseph John

unread,
Feb 20, 2014, 1:21:22 AM2/20/14
to jpassi...@googlegroups.com
Hi
In the lab notes,  1.2 Build MyOnlineShopUsingAbstractClass program
The Electronics class which is a abstract class extended from Product class has to implement all the abstract method of Parent Product, But in the notes abstract method  computeSalePrice() is not implemented in Electronics.java class

Attached is the screen shot of the notes
thanks
Joseph John

AbstractMethod-ComputeSalePriceNotthere.png

Martin

unread,
Feb 23, 2014, 3:05:11 PM2/23/14
to jpassi...@googlegroups.com
I do not think so. 

Lets look at it.

abstract class Product --> abstract class Electronic --> class MP3Player ... implements computeSalePrice()

So you are implementing public double computeSalePrice() in MP3Player class. That's absolutely correct.

Abstract class which has super (parent) class do not have to implement any of parent class methods because it is still abstract class. Abstract class is not here to implement anything. Class derived from abstract class has to implement functions. 

I recommend you to go again over "Inheritence" lesson to understand this better.
--
Martin

Dne čtvrtek, 20. února 2014 7:21:22 UTC+1 Joseph John napsal(a):

Joseph John

unread,
Feb 23, 2014, 9:07:39 PM2/23/14
to jpassi...@googlegroups.com
Thanks martin
Thanks for the explanation


--
You received this message because you are subscribed to a topic in the Google Groups "JPassion.com: Java Programming" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpassion_java/MZZ7SxaV7Fc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpassion_jav...@googlegroups.com.
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages