Rewrite the following switch statement as a nested if statement using a series of else. . .if
Question:
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;
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
C# Programming From Problem Analysis To Program Design
ISBN: 9781285096261
4th Edition
Authors: Barbara Doyle
Question Posted: