Write an interface iclown that defines one method honk


1 Overview

Dr. Bradbury's Circus of Total Evil travels the galaxy terrorizing children both good and bad. In an effort to save money, Dr. Bradbury has purchased his Robotic Clown Troupe from the Acme Company of Walla Walla, Washington on Planet Earth. The Acme Company's robotic clowns can be funny, scary, or both at the same time. You have been contracted to write a collection of classes that simulate Acme's evil clowns.

2 Background

The initial code from Acme has a clown class named TallGuyClown
public class TallGuyClown
{
public string name;
publicint height;
public void TalkAboutYourself()
{
MessageBox.Show("my name is " + Name
+ " I'm " + height + "feet tall");
}
}

3 The IClown interface

Write an interface IClown that defines one method Honk(). Modify the TallGuyClown class to implement that interface so that calling Honk() will display a MessageBox (as above) that says "Honk my horn!". Add a property FunnyThingIHave to the interface and modify TallGuyClown to implment that property.

4 Adding a new class that implements IClown

Define a new class FunnyClown that uses a private string variable to store the "funny" thing this clown says to the children in the audience. This class should have a constructor that has a single string and use the public FunnyThingIHave property to set the private instance variable. This class needs to define the Honk() method to say "Honk, Honk! I have a" followed by its funny thing.

5 Extending the clown interface

Define a second interface IScaryClown that extends the IClown interface. The new interface needs to define a second string property named myScaryThings and a void method called ScareTheChildrens().

6 Using the IScaryClown interface

Define a new class ScaryClown that uses a private variable to store an integer that was passed to the class in the class constructor. The myScaryThngs getter method needs to return a string consisting of this number followed by "spiders". The ScareTheChilrens() method should pop up a mesasge that says "Boo, Gotcha!". Don't forget to implement the Honk() method.

7 Test framework

Write a test harness for these classes that stores a list of IClown objects. Insert a random collection of TallGuyClown, FunnyClown, and ScaryClown objects into this list. Then traverse the list calling the Honk() method in each object.

Attachment:- Program.zip

Solution Preview :

Prepared by a verified Expert
Programming Languages: Write an interface iclown that defines one method honk
Reference No:- TGS01245501

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)