Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide the detailed solution for each class while explaining every steps in the program including coding for each class Many Thanks Hi our program

Please provide the detailed solution for each class while explaining every steps in the program including coding for each class Many Thanks Hi our program has six classes which are as follows (1) Main, (2) Read, (3) Write, (4) Delete, (5) GameFunction, (6) GameSetup and some ot the class have several methods in them. This is the brief explanation of what the overall program should do.(1) You can add a question into the CSV file using a question and answer as a paramete(both strings). For this function we need to aim to mitigate as many problems as possible such as empty strings passed or empty strings for either the question and answer etc. (2) You can add multiple questions to the CSV using a LiinkedList of question and answers (both string). For this function, you should check for errors before adding questions such as blank entries for questions and/or answers. You should also check the number of questions match the number of answers supplied withing the parameters. (3) You can remove a question and answer via the row ID (4) You can read questions and answers (this function should return Linked Lists ) from the CSV to be used within the game. (5) Finally, we should have a function which starts the game .(a) When the startGame function is called in the main method , the game begins . This function will be stored in a class called GameSetup and proceed to call the appropriate functions for the game to be executed. The GameSetup class structure is as follows this class should call all the relevant function to create the game. It should have a constructor which takes three parameters: the player name, max number of lives, and the number of questions. The obly other function is "void start" . This function should contain all the steps to not only set the game up but play the game. For example here you will read all the data from the CSV files into appropriate variables, you will present the user with questions, get user inputs for the answers , increment scores and lives lost etc. This ideally should be in a loop . You must use functions from different classes to operate the game (b) The program should then ask the user to roll a dice. For this section , the player will need to type "roll" when prompted to. This should generate a random number between 1 and 6and present the number that has been rolled. This will determine the category of the question which will be displayed., the category picked us entirely up to us so we should assign a number to a category. You should then automatically randomly pick a question from the CSV we are using. (c) Once the question has been displayed , the game should prompt the player to type their answer. If the player guesses correctly, they should be prompted to roll again., and the question-and-answer sequence should be repeated . If the guess is incorrect, a life is lost and the user is prompted to roll again. (d) Step (c) should be repeated until either; the specified "lives" amount has been lost in which case the game ends showing user how many answers they got correct, or if the specific max correct answers have been given before max "lives" have been lost. For example if the admin has set the maxQuestions to 10 in the constructor of the GameSetup class then the user should only be able to answer 10 questions correctly as 10 is the maximum score. (6) The GameFunctions - This class should contain functions that the game will use in for it to run (a) pickQuestion And Answer - this function returns a LinkedList which will contain two String values , the question and answer. The question is chosen from a random number which is the third parameter. Parameter 1 and 2 are the list you want to choose from. (b) rollDice - This function should generate a number between 1 and 6. The function has 2 parameters: int min and int max. These values set the lower and upper limits. For this game you will call the function using 1 and 6 as a dice can only roll a number between these two numbers. (c) checkAnswer - This function should compare the user inputted answer to the real answer. The function returns a boolean and has two parameters: String userInput and String realAnser. You should do a comparision and return true if the answer matches or false if its incorrect.

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_2

Step: 3

blur-text-image_3

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

=+b) Create a p chart for these samples.

Answered: 1 week ago

Question

2. What are the prospects for these occupations?pg 87

Answered: 1 week ago