Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Page 2 of 5 COP 3 0 2 2 Java Programming Programming Project 4 See Assignment for due date Project Outcomes: Create a Java application
Page
of
COP Java Programming
Programming Project
See Assignment for due date
Project Outcomes:
Create a Java application that:
Implements file reading and writing
Implements API and user defined exceptions.
Catches and recovers from thrown exceptions
Develops a program with several classes.
JUnit Testing
Creates UML class diagrams.
Prep Reading
Zybooks Chapters
Project Requirements:
In this project you will implement a trivia game. It will ask random
trivia questions, evaluate their answers and keep score. The project
will also have an administrative module that will allow for managing
the question bank. Question bank management will include adding
new questions, deleting questions and displaying all of the questions,
answers and point values.
Project details
Create a class called GameAdministrator the question bank with
the following functionality:
Command line menu.
Stores question data in a text file See details of file
structure below
Enter new questions including answer and question point
value. Point value should be to
Display all of the questions, associated answers and point
value.
The question bank must be stored in a text file with the
following structure
Question Id
Question
Answer
Question point value an int
Create and use a user defined exception to ensure the
point value is between and inclusive
For the purposes of this project the question bank will
contain at least questions.
Example of text menu:
Trivia Game Administration
List all questions
Add question
Quit the Administrator
Enter choice:
Create a class called Player with the following functionality
Players real name
Players gamer nick name
Current total score. Total score is a summation of all the
Players game sessions.
Store the players information in a file named for the
players real name such as JohnSmith.txt Suggest using a
text file
Accessor methods for all instance fields.
Mutators for real name and nick name.
Create a class called Question including
A question ID question, answer, point value see sample
question file
Accessor and mutator methods for all instance fields.
Create a class TriviaGame with the following functionality.
Reads the Questions file
Creates Questions object for each question
Stores the Question objects in collection of Question
objects. Array
Using random number generation, get a random question
for the player to answer and returns that question.
Evaluate the answer and returns the outcome. The
evaluation should ignore case.
Create a class to run the game
Command line
Ask if new player or existing player.
If new player create a player object and ask for required
player informationname nick name, etc
If existing player
prompt for player name
read player information from a text file that contains
the players information.
File format
comma delimited
name, nick name, total score.
If file not found handle exception robustly by
providing error message and asking again.
Create trivia game object
Start the game, the game sequence is
Display a question
Prompt for an answer
Evaluate the answer
Display the evaluation results
Update the players total score
Display the player current game score.
Continue to display new questions until current game
is over. questions
Once game is over
Display his nick name, current game score and
total score.
Write or overwrite the current player data to
the file.
Allow another player to play or quit the program.
Example text based game run after player
determined.
Question
Who is the president?
Obama
That is correct!
Your score is
Question
Who is buried in Grants tomb?
Grant
That is correct!
Your score is
Question
What is the capital of Connecticut?
New Haven
Wrong. The correct answer is Hartford
Your score is
Programmer Design information
As you may have noticed much of the details for this
project are left up to you.
You may create any additional classes, methods especially
private utility methods or instance fields you think may be
needed, however you will be graded on good object
oriented design, so points will be taken off for unnecessary
classes, methods or unused instance fields or instance
fields that should be local variables.
There is no need to add any additional functionality such
as checking for duplicate questions, or duplicate player
files etc, just focus on the required functionality.
JUnit Testing
Create a JUnit Test class for the Question Class
Test the constructors, accessor and Mutator methods.
Create UML Class Diagram for this project.
Design Version completed prior to coding the project to assist
with coding.
Final Version completed after
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started