Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java program Exercise 3: In this exercise, you will be developing a geography quiz that tests kids on their knowledge of countries and their capitals.
java program
Exercise 3: In this exercise, you will be developing a geography quiz that tests kids on their knowledge of countries and their capitals. Download the CountriesCapitals.txt file given next to the lalb link. This file has the country name on one line followed by its capital on the next Afghanistan Kabul Albania Tirana Etc Store the Country-Capital pairs as items in an unordered list. Your application must randomly select a country or a city and ask a question that matches a country to a capital or a capital to a country. It should then search the unordered list and report whether that answer is correct or incorrect. At the end of the program, display a statistic of how well the player answered the questions. Here's a sample screen dialog Welcome to the Country-Capital Quiz Play? Yes What is the capital of Canada? ottawa Correct. Play? Yes What country has Vienna as its capital? Austria Correct. Play? Yes What is the capital of Albania? Algiers Incorrect. The correct answer is Tirana. Play? No Game over. Game Stats: Questions played : 3; Correct answers: 2; Score: 66.67% NOTE: Only one output that shows a dialogue similar to the above is sufficient And the CountriesCapitals.txt is look like this: Afghanistan Kabul Albania irana Algeria Algiers Andorra Andorra la Vella Angola Luanda Antigua and BarbudaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started