Task 1 Two-dimensional array and String (Guess the capitals) Write a program that repeatedly prompts the user to enter a capital for a Canadian province/territory. Upon receiving the user input, the program reports whether the answer is correct. Assume that the provinces/territories and their capitals (as shown in the following table and figure) are stored in a two-dimensional array: Alberta British Columbia Manitoba New Brunswick Newfoundland and Labrador Nova Scotia Ontario Prince Edward Island Quebec Saskatchewan Yukon Nunavut Edmonton Victoria Winnipeg Fredericton St. John's Halifax Toronto Charlottetown Quebec City Regina Whitehorse Iqaluit
Task 1 Two-dimensional array and String (Guess the capitals) Write a program that repeatedly prompts the user to enter a capital for a Canadian province/territory. Upon receiving the user input, the program reports whether the answer is correct. Assume that the provinces/territories and their capitals (as shown in the following table and figure) are stored in a two-dimensional array: Alberta British Columbia Manitoba New Brunswick Newfoundland and Labrador Nova Scotia Ontario Prince Edward Island Quebec Saskatchewan Yukon Nunavut Edmonton Victoria Winnipeg Fredericton St. John's Halifax Toronto Charlottetown Quebec City Regina Whitehorse Iqaluit
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Write the code in java and please dont use

Transcribed Image Text:Task 1 Two-dimensional array and String (Guess the capitals)
Write a program that repeatedly prompts the user to enter a capital for a Canadian
province/territory. Upon receiving the user input, the program reports whether the
answer is correct. Assume that the provinces/territories and their capitals (as shown
in the following table and figure) are stored in a two-dimensional array:
Alberta
British Columbia
Manitoba
New Brunswick
Newfoundland and
Labrador
Nova Scotia
Ontario
Prince Edward Island
Quebec
Saskatchewan
Yukon
Nunavut
Northwest
Victoria
Yukon
Northwest
British
Columbia
Territories Nunavut
Alberta
Edmonton
CANADA- Political
Regina
International boun
------ Provincial/tritorial boundary
Alberta Provincetembory
Ottawa National capital
+Regina Provincial/territorial capital
Saskatchewan
Manitoba
Ontario
Scale
250 500 750 1000 km
Edmonton
Victoria
Winnipeg
Fredericton
St. John's
Halifax
Toronto
Charlottetown
Quebec City
Regina
Whitehorse
Iqaluit
Yellowknife
Newfoundland and Labrador
Quebec
Ottawa
New
Brunswick
John's
Prince
-Edward
✓ Island
Halifax
Nova
Scotia
(The figure is taken from Wikipedia
at https://simple.wikipedia.org/wiki/Provinces_and_territories_of_Canada)

Transcribed Image Text:The program prompts the user to answer all provinces/territories' capitals and
displays the total correct count. The user's answer is NOT case-sensitive. A sample
run is as follows:
What is the capital of Alberta? calgary
The correct answer should be Edmonton
What is the capital of British Columbia? victoria
Your answer is correct
What is the capital of Manitoba? Winnipeg
Your answer is correct
What is the capital of New Brunswick? Fredericton
Your answer is correct
What is the capital of Newfoundland and Labrador? st. john's
Your answer is correct
What is the capital of Nova Scotia? Halifax
Your answer is correct
What is the capital of Ontario? Toronto
Your answer is correct
What is the capital of Prince Edward Island? Charlottetown
Your answer is correct
What is the capital of Quebec? Montreal
The correct answer should be Quebec City
What is the capital of Saskatchewan? Regina
Your answer is correct
What is the capital of Yukon? Whitehorse
Your answer is correct
What is the capital of Nunavut?
The correct answer should be Iqaluit
What is the capital of Northwest Territories? Yellowknife
Your answer is correct
The correct count is 10
Notes:
O Some capitals contain more than one word. Thus, the next() method is
not appropriate for reading the input. Consider reading the input as a
line.
O To make the answer not case-sensitive, choose a uniform case (either
uppercase or lowercase) when comparing the user's answer and the
solution.
O For simplicity, we do not deal with the non-letter symbols in the capital
name "St. John's". The correct answer has to include . and. For example,
"st John's" will be considered as a wrong answer.
O For simplicity, we do not deal with extra/missing spaces in the capital
names. For example, "yellow knife", "QuebecCity", and "St. John's" will
be considered as wrong answers.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education