Answered step by step
Verified Expert Solution
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 Main, Read, Write, Delete, GameFunction, GameSetup and some ot the class have several methods in them. This is the brief explanation of what the overall program should do You can add a question into the CSV file using a question and answer as a parameteboth 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. 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 andor answers. You should also check the number of questions match the number of answers supplied withing the parameters. You can remove a question and answer via the row ID You can read questions and answers this function should return Linked Lists from the CSV to be used within the game. 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 and and 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 questionandanswer 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 in the constructor of the GameSetup class then the user should only be able to answer questions correctly as is the maximum score. 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 and are the list you want to choose from. b rollDice This function should generate a number between and The function has parameters: int min and int max. These values set the lower and upper limits For this game you will call the function using and 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
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