Convert the following if/else if statement into a switch statement

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

Convert the following if/else if statement into a switch statement:

if (choice == 1)

{

    cout << “one”;

}

else if (choice == 2 || choice == 3)

{

    cout << “Twenty three”;

}

else if (choice == 4)

{

    cout << “four”;

}

else

{

    cout << “ten”;

}

 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT