Acceptance criteria
- The specified behavior or explanation is demonstrated using the detailed tasks below.
8.1 Adapter Pattern Lab
This assignment is based off Head First Designs p. 235-270
Work through the stories in order. Use the acceptance criteria to check each feature, and complete the nested tasks using the specified names, values, and scenarios.
Fly and Gobble on the wildTurkey object.Some animal enthusiast organization has asked that you incorporate their Turkey library and use them as ducks.
'Add Reference...''Browse...' and select the TurkeyService.dll from the zip provided.MainWindow after instantiating the MallardDuck...WildTurkey object named wildTurkey after the MallardDuck.You will need to add a using for TurkeyService.
Fly and Gobble on the wildTurkey object.
Line 1: Testing the turkey. . .
Line 2: I'm flying a short distance.
Line 3: Gobble gobble
Line 4:
Line 5: Testing the duck. . .
Line 6: I'm flying
Line 7: QuackFly and Gobble methods.Duck exposes the required contract: Fly(); Quack().TurkeyAdapter exposes the required contract: TurkeyAdapter(turkey: ITurkey); Fly() override; Quack() override.ITurkey exposes the required contract: Fly(); Gobble().Fly and Gobble methods.TestDuck and pass in the wildTurkey.This isn't possible because TestDuck only takes IDuck types.
WildTurkey. You can't change anything about the class so no help there.TestDuck.TurkeyAdapter class based on the diagram below.Class: Duck
Methods
+ Fly()
+ Quack()
Class: TurkeyAdapter
Inherits from Duck
Fields
- turkey : Turkey
Methods
+ TurkeyAdapter(ITurkey turkey)
+ Fly<override>
+ Quack()<override>
Interface ITurkey
Methods
Fly()
Gobble()TurkeyAdapter class...Quack method, call the turkey's Gobble method.Fly method, write a for loop that calls the turkey's Fly method 5 times.TurkeyAdapter object named turkeyDuck and pass in the wildTurkey object to the constructor.TestDuck and pass in the turkeyDuck.
Line 1: Testing the turkey. . .
Line 2: I'm flying a short distance.
Line 3: I'm flying a short distance.
Line 4: I'm flying a short distance.
Line 5: I'm flying a short distance.
Line 6: I'm flying a short distance.
Line 7: Gobble gobble
Line 8:
Line 9: Testing the duck. . .
Line 10: I'm flying
Line 11: QuackReturn to each story and verify its acceptance criteria. Preserve the submission format and destination stated in the activity; a reading, setup guide, lab, video demonstration, and oral final may require different evidence.
Run the application. The Console should print out the behavior of the mallard duck. Import the TurkeyService. Build an adapter.