Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a trivia game for two players in Java. The program will work like this: When the game starts, it needs to retrieve all possible

Create a trivia game for two players in Java. The program will work like this: When the game starts, it needs to retrieve all possible questions from the question bank file. Also, it provides the players the options to submit their own questions or start playing. If the players choose to play, 10 questions will be randomly selected for each player. After the questions have been chosen, asks both players to enter their names and then allow player 1 to play. Each player gets a turn at answering 10 trivia questions. (There are a total of 20 questions, 10 for each player.) When a question is displayed, four possible answers are also displayed. Only one of the answers is correct, and if the player selects the correct answer within 10 seconds, he or she earns a point. After answers have been selected for all the questions, the program displays the number of points earned by each player and declares the player with the highest number of points the winner. If the players decide to submit their own questions, they need to provide the question statement, four possible answers and the correct answer. The new question submitted must be added to the question bank file for future play. You are to design a Question class to hold the data for a trivia question. The Question class should have private fields for the following data and appropriate methods for initializing, setting and retrieving these data. o A trivia question o Possible answer #1 o Possible answer #2 o Possible answer #3 o Possible answer #4 o The number of the correct answer (1, 2, 3, or 4) The program should create either an array of 20 Question objects or two arrays of 10 questions each.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

What is the relationship between diversity, inclusion, and equity?

Answered: 1 week ago