Question: Coding that you can assume has been created already and which you do not need to write: An int variable named stateCode has been declared

Coding that you can assume has been created already and which you do not need to write:

  • An int variable namedstateCodehas been declared and has a valid value.
  • A String variable named stateRegionhas been declared and initialized to the empty string.

Code you are to write:

an if-else structure to store the text name of a US region in the variable namedstateRegionbased upon the value of stateCode. This question is testing your knowledge of if-else structures. You are required to use ONE if-else structure for this question.

    • if the code is 12 the stateRegion is "Florida"
    • if the code is 1 or 13 the stateRegionis "Borders Florida"
    • if the code is 33 - 35 the stateRegion is "Not Near Florida"
    • For all other valid state codes place "State Not Used for this Example" in thestateRegion

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

if stateCode 12 stateRegion ... View full answer

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 Programming Questions!