Lab Task 8 - 1
Lab Task 8 - 1
Task_1:
Bird
-Name : String
-Color:String
+Bird()
+Bird(String, String)
+toString():String
Fly
Duck -canFly : Boolean
-duckFly : Fly -Age : int
+Fly()
+Duck() +Fly(Boolean, int)
+Duck(String, String, Fly) +SetFly(Boolean): void
+SetFly(Fly): void +GetFly():Boolean
+GetFly():Fly +toString():String
+toString():String
Create a ‘Bird’ class as parent class. Duck class extends Bird class as shown in UML Diagram.
Create a Fly object which is created in Duck class.
Task_2:
- Create BirdDriver class with main method.
- Create Fly object.
- Create Duck object and pass Fly class as an argument in its constructor.
- Print details of the Duck from toString() method.