Question: Write a program that repeatedly prompts the user to enter a capital for a state. Upon receiving the user input, the program reports whether the
Write a program that repeatedly prompts the user to enter a capital for a state. Upon receiving the user input, the program reports whether the answer is correct. Assume that 50 states and their capitals are stored in a twodimensional array, as shown in Figure 8.10. The program prompts the user to answer all states? capitals and displays the total correct count. The user?s answer is not case-sensitive.
Figure 8.10
Here is a sample run:
Alabama Montgomery Juneau Alaska Arizona Phoenix What is the capital of Alabama? Montogomery -Enter The correct answer should be Montgomery What is the capital of Alaska? Juneau -Enter Your answer is correct What is the capital of Arizona? ... The correct count is 35
Step by Step Solution
3.32 Rating (164 Votes )
There are 3 Steps involved in it
A program reads the names of the states and their capitals from a file and asks the user 10 random n... View full answer
Get step-by-step solutions from verified subject matter experts
