Question: Rewrite the following switch statement as a nested if statement using a series of else. . .if statements: string birdName; switch (birdName) { case Pelican:

Rewrite the following switch statement as a nested if statement using a series of else. . .if statements:

string birdName;

switch (birdName)

{

case "Pelican":

Console.WriteLine("Lives near water.");

break;

case "Cardinal":

Console.WriteLine("Beautiful in the snow.");

break;

case "Owl":

Console.WriteLine("Night creature.");

break;

case "Eagle":

Console.WriteLine("Keen vision");

break;

case "Flamingo":

Console.WriteLine("Pretty and pink.");

break;

default:

Console.WriteLine("Can fly.");

break;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Systems Analysis Design Questions!