tut04_2009_r1 - EE3206/EE5805 Java Programming and...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE3206/EE5805 Java Programming and Applications Tutorial 4 – Using Inheritance and Polymorphism 1. Objects in the real world are often derived from each other, and hence have great similarity. The following table summarizes the features of a popular series of electronic devices. Model these devices using classes and objects. Storage Battery Video Playback Cellular Connectivity Camera Digital Compass APod Touch 32G/64G 800 mAh mp4, mov No No No APhone 3G 8G 1150 mAh mp4, mov Yes 2 mega pixels No APhone 3G[S] 16G/32G 1220 mAh mp4, mov Yes 3 mega pixels Yes To simplify the implementation, you only need to print some pseudo messages to emulate the operations. A sample implementation of APod Touch has been done for you in Code 1. Each implementation should have a method playShowcase() that displays all features of the device. 2. Use object inheritance to improve your design. Distinguish the superclasses and subclasses and rewrite your classes when necessary. What are the advantages of using inheritance to model classes with similar properties? 3.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2010 for the course ELECTRONIC EE3206 taught by Professor Tingchiwang during the Spring '10 term at École Normale Supérieure.

Page1 / 2

tut04_2009_r1 - EE3206/EE5805 Java Programming and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online