Assignment 2 - Trivia Game
Assignment 2 - Trivia Game
Due: Wednesday, October 18, 2017 noon (just before the lecture starts)
Weight: 5%
The assignment is to be completed individually, in accordance with the policies and expectations in the course
outline.
Objectives:
Associated textbook sections: before starting, students should be familiar with most of Chapter 8
Note: You cannot use array lists at all for this assignment. You must use only arrays. There will be severe
deductions if you use an ArrayList!
Short summary
You will be creating a program that implements a basic trivia game. The game is conducted like a multiple choice
exam where the user is presented with a question and a list of possible choices. The user answers the questions and
the final score and statistics are displayed once the user has either quit or finished the game. While playing the
game the user should have the ability to quit at any time and to skip any question (which counts as an automatic
fail on that specific question).
Your program will load the trivia questions from a file at the start of the program. The file name will be specified
though command line arguments.
Note: To set up your project, copy the Assignment 2 folder in the Resource drive to your H drive. Then rename the
folder <LastName>_<FirstName>_Asg2 and launch the project in the folder. You must use the test
cases document in the folder.
Page 1 of 5
September 20, 2017 [COMP 1502 ASSIGNMENT 2 - ARRAYS AND TRIVIA GAME]
This description assumes the name of the main class is TriviaGame. If you choose a different name, substitute that
name each time to read TriviaGame.
Page 2 of 5
September 20, 2017 [COMP 1502 ASSIGNMENT 2 - ARRAYS AND TRIVIA GAME]
Welcome Message
*** Welcome to the Trivia Game ***
Processing file: good
There are 5 questions
Question Header
Question qn of qt
Total points so far tp
This question is worth pp points
Note: The Question Header in test cases it will be described as Question Header (an, qt, tp, pp)
Option Menu
Here are your options:
A first possible answer
B second possible answer
C third possible answer
D fourth possible answer
E fifth possible answer
S skip this question
Q - quit
What is your choice?
Note: If there are only two possible answers then options C, D and E will not be presented.
Summary Statistics
The final score is ss out of sp
You answered tq questions correctly
ts questions were skipped
Note: The Summary Statistics in the test cases will be described as Summary Statistics (ss, sp, tq, ts)
Page 3 of 5
September 20, 2017 [COMP 1502 ASSIGNMENT 2 - ARRAYS AND TRIVIA GAME]
1. The first line will contain one number that indicates how many questions are in the file. All of the following
lines will include information for each question in the order they are to be presented to the user.
2. Each stored question will have the following format:
a. The first line will contain 1 number followed by 1 string followed by another number
i. The first number is the point value of the question
ii. The string indicates the correct answer to the question ( this will be any uppercase
character like: A,B,C, etc.)
iii. The second number is the number of answers to present to the user (n)
b. The next line will contain the text of the question (that will be presented to the user)
c. The following n lines will contain the possible choices ( the first line being choice A, next line choice
B and so forth)
3
1 C 4
what is the capital of Australia?
Sydney
Melbourne
Canberra
Perth
2 A 3
Ionic, Doric and Corinthian are all orders of what important structure?
Columns
Arches
Domes
8 D 4
In what country was origami invented?
China
Canada
Russia
Japan
B Arches
C Domes
3. Points=8, answer = D and 4 choices
In what country was origami invented?
A China
B Canada
C Russia
D Japan
Submission Instructions
Before attempting the steps below, ensure your solution compiles without errors or warnings, ensure all existing
automated tests pass (if there are any), and ensure your program works as expected. Correct any problems before
continuing. Code that does not compile and cant be tested will be heavily penalized.
Important reminder: this assignment is to be completed individually. Students are strictly cautioned against
submitting work they didnt do themselves.
Page 5 of 5