Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

for a liberty basic homework :( Write a program to fetch state and marital statu

ID: 3679393 • Letter: F

Question

for a liberty basic homework :(

Write a program to fetch state and marital status of 5 users.

Use NESTED SELECT..CASE to find out the number of people who belong to each of the regions below.
If the user is from “CA”, “NV”, “AR”, “WA”, count them towards westernregion
If the user is from “NY”, “MA”, “FL”, display count them towards eastern region
If the user is from “TX”, “AL”, “GA”, display count them towards southern region
ELSE display “ You might be from Midwestern states"
Within each region, count the number of people who are married, single, divorced and separated.

Explanation / Answer

Answer:

Note: language is not specified hence I used VB to code

Code:

Dim choice1 As Integer=10

Dim choice2 As Integer=4

Select Case choice1

Case 1 To 4

     Debug.WriteLine("Western Region");

Case 5 To 7

     Debug.WriteLine("Eastern Region");

Case 8 To 10

     Debug.WriteLine("southernRegion");

Case Else

     Debug.WriteLine("You might be from Midwestern states");

Select Case choice2

Case 1

     Debug.WriteLine("married");

Case 2

     Debug.WriteLine("Single");

Case 3

     Debug.WriteLine("Divorced");

Case 5

     Debug.WriteLine("separated");

Case Else

     Debug.WriteLine("NOT");

End Select

End Select