Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What I need: Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an interface named ITurnable that

What I need:

Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf.

Create an interface named ITurnable that contains a single method named Turn(). The classes named Page, Corner, Pancake, and Leaf implement ITurnable.

Create each classs Turn() method to display an appropriate message. For example:

  • The Pages Turn() method should display You turn a page in a book.
  • The Corners Turn() method should display You turn corners to go around the block.
  • The Pancake's Turn() method should display You turn a pancake when it's done on one side.
  • The Leaf's Turn() method should display A leaf turns colors in the fall.

What I have:

using System; namespace InterfaceDemo { interface ITurnable{ void turn(); } class Page:ITurnable{ public void turn(){ Console.WriteLine("You turn a page in a book"); } } class Conrner:ITurnable{ public void turn(){ Console.WriteLine("You turn corners to go around the block"); } } class PanCake:ITurnable{ public void turn(){ Console.WriteLine("You turn a pancake when it's done on one side"); } } class Leaf:ITurnable{ public void turn(){ Console.WriteLine("A leaf turns colors in the fall."); } } class Program { static void Main() { ITurnable t= new Page(); t.turn(); t= new Conrner(); t.turn(); t=new PanCake(); t.turn(); t=new Leaf(); t.turn(); } }

}

Error I get:

Compilation failed: 3 error(s), 0 warnings NtTest2a8c4304.cs(12,26): error CS0246: The type or namespace name `ITurnable' could not be found. Are you missing `InterfaceDemo' using directive? NtTest2a8c4304.cs(23,7): error CS0246: The type or namespace name `Corner' could not be found. Are you missing an assembly reference? NtTest2a8c4304.cs(24,7): error CS0841: A local variable `corner' cannot be used before it is declared

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

58. How can an individual save and invest in a corporation

Answered: 1 week ago