hey everyone! you see, i have this assignment to do... and i am having trouble trying to come up with a program entitled "Trivia Master"... the following are the given info for you guys out there who (i hope!) would help me around here... help on coming up with a source code for the whole program or even just a function is gladly appreciated... thanks!
The purpose of Trivia Master is to be able to allow the user to guess the correct answer to the question under the category. Of course, the questions, the answers, and the choices should come from some source. To provide flexibility of the system, these data should also come from the user. Thus, there are two phases in this project. One is the Maintenance Phase, while the other is the Quiz Phase. One run may consist of going through the Maintenance Phase, Quiz Phase, Quiz Phase, Maintenance Phase, .... , Exit.
Under each topic/category (minimum input length should be 1 and maximum string length of input is 25 characters), there can be a maximum of 100 trivia. Each trivia consists of the following:
The question consists of a minimum of 1 and a maximum of 500 characters
2. Correct Answer
The answer consists of a minimum of 1 and maximum of 25 characters
3. 3 Incorrect Choices
The choices consist of a minimum of 1 and a maximum of 25 characters each
Instead of hard coding these topics, questions, answers, and choices in your program, your program should provide a user-friendly interface, as well as the functionality to do the following:
1. Add Topic
Your program should allow creation of a new topic/category and adding of its corresponding trivia. Make sure that in adding a category, the category does not exist yet. However, if the category already exists, the trivia may still be added under the existing category. Note that there is no limit to the number of categories that may be added to your database. Also note that there should at least be one trivia under a topic; otherwise the category will not be created.
2. Add Trivia
Your program should allow your user to add a trivia to your list of questions, answers, and incorrect choices. Make sure that there are data in each field of the entry. Make sure that there is no duplicate question in the list of trivia. Make sure also that the correct answer is not part of the incorrect choices. Lastly, checking should also be done for same incorrect choice in a given question. Assume that capital letter entries are not the same as lowercase entries (i.e., What, WHAT, what are not the same).
Your program should allow your user to edit or modify an existing entry. Note that not the entire entry should be retyped. The user may choose to edit the category and this new name should be unique. Show a listing of the category names (in alphabetical order) first before asking which will be modified. The user may alos choose to just change the answer or one of the choices. Make sure that the change is valid. If it is the question that is to edited, make sure that it is not a duplicate of an existing question in the same category. If the answer will be edited, make sure that the replacement is not among the incorrect choices. If an incorrect choice will be replaced, make sure that the new choice is not the answer or the same as the other incorrect choice. Make sure also that the new data should contain at least 1 character.
Your program should allow your user to delete an entire category. Only an existing category may be deleted. Provide your user with a listing of all categories in alphabetical before asking which he wants to delete. Note that in deleting a category, all trivia under that category will automatically be removed. Your program should also allow your user to choose which trivia to delete based on the list of questions. Display a maximum of 5 questions each time before moving to the next set. ONly existing entries can be deleted.
5. View by Category
Provide a listing of the available category names (in alphabetical order) before asking your user to type the category whose trivia he wants to view. All data/information about each trivia (under the given category) should be shown. Display each trivia one at a time until all entries have been displayed. Provide away for the user to view the next or the previous tivia.
Your program should allow all data to be saved into a text file. The data stored in the text file can be used later on. The system should allow the user to specify the filename. Filenames have at most 25 characters including the extension. Extension of file to be saved is .txt. If the file is existing, the data will be overwritten.
Save the file in the following format:
Your program should allow the data stored in the text file to be loaded into the program. The user should be able to specify which file to load. The user should be able to specify which file to load. Note that if the same category name exists, the trivia is added to the one in the program if the trivia is unique to that category. If the trivia question is a duplicate (in the same category), the system has to prompt the user if he wants the existing data in your program to be overwritten. If the user said yes, your program should replace the existing trivia (correct answer and incorrect choices) of the category with one from the text file. On the other hand, if the user said no, your program retains the trivia of the category in the program. If there is no similar category, it will be added to your database. The data in the text file is stored in the format specified in Export. When you load te text file, assume the file is already in the correct format. Note that the categories in the file may not be arranged in alphabetical order.
The exit option will just allow the user to quit the Maintenance Phase.
1. Load Database
Your program asks the user to specify the filename of a text file where the questions will originate. The information should be loaded into a list.
2. Quiz by Category
If the list is empty, the user will not be allowed to take the quiz. But, if there is some information in the list, the list of categories is shown in alphabetical order for the user to choose from. From the chosen category, 10 questions will be randomly picked (and given in random order) by the system. A question may only be repeated within a quiz if all questions in the given category are already given. Note that the correct answer is not always the first, nor the second, third, or fourth option). The user may choose to exit the quiz anytime. After the user answers all 10 questions, the category name, the questions, the user's answer, and the correct answer is saved into a non-text file (filename with maximum length of 25 and extension of .exm will be specified by the user). If the file exists, the data will be overwritten with the new quiz.
2. Comprehensive Quiz
If the list is empty, the user will not be allowed to take the quiz. Fifteen questions will be randomly picked and given to the user from random/different categories. A question may only be repeated in a quiz if all questions in all categories had already been given. Again, the correct answer should appear in random position/order of choices. The user may choose to exit the quiz anytime. After the user answers all 15 questions, the category name, questions, the user's answer, and the correct answer is saved into a non-text file (filename specified by the user).
3. Show Quiz Report
The program asks for the filename of a non-text file from the user. Each question, user's answer, and correct answer is displayed one at a time. The statistics (number of questions answered correctly and total number of questions given and the percentage) is also shown.
The exit option will just allow the user to quit the Quiz Phase.