Create a trivia game. The end user will be asked randomized questions and it will check answer and keep score. There will also be an admin portion that allows modification of the questions asked. The admin part will be able to add, delete, and view questions (with the questions answer and point value).
The admin class will have:
a basic GUI
stores question data in a Random Access File
enter question/answer with associated point value
delete question by searching for question in the random access file
show questions, associated answers and point value
questions must be stored in binary Random Access File with this structure: question 50 bytes, answer 20 bytes, question value int
create and use user defined exception to make sure q&a do not go over the number of bytes set forth in your record structure and point value is 1-5
15 questions in question bank
Create a class for game user data with the following ability:
the user's name
user's gamer name (like their gamer tag)
current total score (sum of all user's game sessions)
ability to store user object to a serialized file, and the file will be named after the user's real name such as johndoe.dat. Don't worry about duplicate file names.
Create a class for the questions that include:
question, answer, value, and questionID
accessor method to return all instance field (like a toString)
Create a class to store a trivia game object that does the following:
stores all question objects
use random number generation to read 5 questions for the place that stores the questions in set.
return next question object in set
checks answer and returns the outcome while ignoring case
Create class to run game
GUI
ask if existing user
if new then create a new user object and ask for required user data
if existing then prompt for user name and read info from serialized file if file isn't found then handle exception robustly by providing error message and prompting again
create trivia game object
start the game in this sequence
display question
prompt answer
check answer
display check results
update users total score
display the users current game score
continue to display new question until game is over (5 questions)
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.