
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
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 stepSolved 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.Similar questions
- Which of the following is FALSE about the Assembly language? a. A program called compiler translates assembly language into machine language. b. The design of the processor must be known. c. Mnemonics are used for the instructions. d. Assembly language is easier for humans than machine language.arrow_forwardChoose the right answer from among the following statements. The term "utilities" refers to applications such as word processors, spreadsheets, e-mail clients, web browsers, and games.arrow_forwardWould appreciate your help thanksarrow_forward
- Cis compiler dependent. a. False O b. Truearrow_forwardWhich of the following should be considered by compilers in order to generate accurate and efficient code? Explain.arrow_forward28. The scheme of which interpreter translates the source program is known as a. Paragraph by paragraph b. Instruction by instruction c. Line by line d. None of the abovearrow_forward
- Write a program that accepts two four-digit binary numbers, converts them to decimal values, adds them together, and prints both the decimal values and the result of the addition. Requirements: Functionality. (80pts) No Syntax Errors. (80pts*) *Code that cannot be compiled due to syntax errors is nonfunctional code and will receive no points for this entire section. Clear and Easy-To-Use Interface. (10pts) Users should easily understand what the program does and how to use it. Users should be prompted for input and should be able to enter data easily. Users should be presented with output after major functions, operations, or calculations. All the above must apply for full credit. Users must be able to enter a 4-bit binary number in some way. (10pts) No error checking is needed here and you may assume that users will only enter 0’s and 1’s, and they will only enter 4 bits. Binary to Decimal Conversion (50pts) You may assume that users will only give numbers that add up to…arrow_forwardCompared to print statements, what are the benefits and drawbacks of manually walking through code? Discuss?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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