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.10Alabama Montgomery Juneau Alaska Arizona Phoenix What is the capital of Alabama?

Here is a sample run:Montogomery -Enter The correct answer should be Montgomery What is the capital

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

1 Expert Approved Answer
Step: 1 Unlock

A program reads the names of the states and their capitals from a file and asks the user 10 random n... 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 Java Programming Questions!