Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Skills Demonstrate the understanding of input, process, and output Demonstrate the understanding of relational and logical operators Demonstrate the understanding of conditional expressions Demonstrate the

image text in transcribedimage text in transcribed
Skills Demonstrate the understanding of input, process, and output Demonstrate the understanding of relational and logical operators Demonstrate the understanding of conditional expressions Demonstrate the understanding of loops Demonstrate the use of validating user input Demonstrate the use of conditional expressions Demonstrate the use of while loop, do-while loop, or for loop . Demonstrate the use of nested loops Demonstrate formatting output . Demonstrate programming style and documentation Problem Statement Write a program that asks the user to enter a single letter. Your job is to match that letter to one of the 50 US states and print out the state name If there is only one possible match (e.g., "D" would cause you to print Delaware) just output that state name. Letters that match to more than one possible state (like "'S" for South Carolina or South Dakota) would require an additional input from the user. Display all the possible states in a menu. Prompt the user to enter a number in the menu; say 1 for South Carolina or 2 for South Dakota). Make sure your program accounts for all possibilities (e.g., 4 states begin with the letter A, 3 states begin with the letter c). Here is the list of state names: Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Indiana Illinois IowaHints 1. Allow the user entering upper-case or lower-case letters 2. Validate user input for an acceptable value before processing so a. In the first user input, only letters will be accepted b. In the second user input, only selections listed in the menu will be accepted 2. If the user entered an unacceptable value, instead of terminating the program, prompt the user again until a valid input is entered before processing 3. You may use if / else or switch statements 4. When a letter matches more than one possible state a. Display a menu b. Use nested statements; you may use if / else if or switch statements 5. There should be a catch-all statement(s) that would catch letters that don't match any state (like "Z") or an invalid menu choice is entered; and then display something like "no match for that letter" 6. Allow the user to play again until a sentinel is entered

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions