Select Case intLevel Case 1, 2 strStatus = "Bronze" Case 3 To 5 strStatus = "silver" Case 6, 7 strStatus = "Gold" Case Else strStatus "Platinum" End Select

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

What will the code in Figure 4-55 assign to the strStatus variable when the intLevel
variable contains the number 7?
a. Bronze
b. Gold
c. Platinum
d. Silver 

Select Case intLevel
Case 1, 2
strStatus = "Bronze"
Case 3 To 5
strStatus = "silver"
Case 6, 7
strStatus =
"Gold"
Case Else
strStatus
"Platinum"
End Select
Transcribed Image Text:Select Case intLevel Case 1, 2 strStatus = "Bronze" Case 3 To 5 strStatus = "silver" Case 6, 7 strStatus = "Gold" Case Else strStatus "Platinum" End Select
Expert Solution
Step 1

To know the assigned value to the variable named strStatus when the variable named intLevel is initialized with the number 7.

 

The given code is:

 

Select Case intLevel

       Case 1, 2

              strStatus = "Bronze"

       Case 3 To 5

              strStatus = "Silver"

       Case 6, 7

              strStatus = "Gold"

       Case Else

              strStatus = "Platinum"

End Select

Step 2

In the above code,

 

The Select Case statement contains a variable named intLevel.

 

The first Case is executed for the value 1 and 2 of the variable named intLevel.

This Case assigns the code "Bronze" to the variable named strStatus.

 

The second Case is executed for the value 3 to 5 of the variable named intLevel.

This Case assigns the code "Silver" to the variable named strStatus.

 

The third Case is executed for the value 6 and 7 of the variable named intLevel.

This Case assigns the code "Gold" to the variable named strStatus.

 

The fourth Case is executed for the other values of the variable named intLevel.

This Case assigns the code "Platinum" to the variable named strStatus.

 

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
ListBox
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage