5 Bianca has started to write a program.
The program is a guessing game about countries and their capital cities.
Open Q05 in the code editor.
The program already:
• displays this menu
Menu
[1] Add player name
[2] Play guess the capital city
[3] End game
Input your menu choice:
• asks for the user’s menu choice.
Write the program code for the menu choices.
Menu choice [1] Add player name
If a player chooses this option, then they must input a player name.
Menu choice [2] Play guess the capital city
If a player chooses this option, then:
• they must answer five questions
• they select a question to answer by choosing a valid question number
• each question can only be selected once (they must not be able to choose
a number more than once)
• the question should be displayed
• they must input the name of the capital city
• if they guess correctly their score must be incremented by 1
• if they guess incorrectly the correct answer must be displayed.
Menu choice [3] End game
If the user chooses this option, then the player name and score should be displayed.
Your program should function correctly even if the number of countries and
capital cities in the file is increased.
Save your code as Q05FINISHED with the correct file extension for the
programming language.
(20)
14
*P66490A01416*
You may use this space for planning / design work.
The content of this page will not be assessed.
(Total for Question 5 = 20 marks)
TOTAL FOR PAPER = 80 MARKS
15
*P66490A01516*