Professional Documents
Culture Documents
OOP - Lab Task-10 - AbstractClass - Interface
OOP - Lab Task-10 - AbstractClass - Interface
1. Suppose you are developing a game where the main actor is monster. In your game, every
monster has name and its special power (such as fire, water or Stone) to attack. Now
following UML is given to you. Covert the following UML into Java code
Monster
#name: String
+Monster(String)
+attack():void
Is-a
FireMonster StoneMonster
WaterMonster
has -power: String
has
+ WaterMonster (String,String)
+ display(): void
has
MyClass
+main(String) : void
2. Covert the following UML into Java code. Create at least one object of each class and
implement all the methods.
Part-B: Interface
3. Covert the following UML into Java code. Create atleast one object of each
CD DVD player class and implement all the methods
<<Player>>
+play() : void
+stop() : void
+pause() : void
+reverse() : void
Is-a Is-a
CDPlayer DVDPlayer
-name :String -name :String
+ CDPlayer (String) +DVDPlayer (String)
+audio() : void +video() : void
has
has
MyClass
+main(String) : void
Part-C: Abstract Class and Interface Solve any one