In this assignment we are going to contruct a complete new application that works with the quiz database.
This application will allow students to take quizzes.
The three main operations that the application needs to support are
You can accomplish all of this in a fairly straightforward way by using a single window that displays a list of students, a list of quizzes, and a list of questions by using a ChoiceBox, a ChoiceBox, and a ListView. Below the ListView you can display a question and then let the user answer the question by clicking one of four buttons. If you want, you can also tell users whether or not they got the answer right immediately after they click the button for their guess.
Another thing you need to watch out for is making sure that students don't get to submit more than one answer for a given question. To handle this, you need to add some additional logic to your application that checks whether or not that student has already answered that question before submitting the answer to the database.
Start by making a new, empty schema in the MySQL workbench with the name quiz.
If you go back to the lecture notes I posted for the quiz writing example you can download the project folder for my example. Inside that project folder you will find a database folder. You can use the data import tools in the MySQL Workbench to import those database files into MySQL.
You can read the list of students from the database: those are stored in the students table. Likewise, you can find a list of quizzes in the quizzes table. Once your user has selected a quiz from the list of quizzes you can find the questions for that quiz in the questions table.
When your user answers one of the questions you should first go to the responses table to make sure that they have not already answered that question. (Helpful hint: when you run the query to find answers that that student has given for that quiz you can call the result set's next()
method. If that method returns true, you will know that that student has already answered that question.)
Once you have established that the user has not already answered that question you can insert their answer in the responses table. Note that one of the columns in that table records whether or not the student's response was correct. You should put a 0 in this column if they gave the wrong answer and a 1 if they gave the correct answer.
For this project you will be working with a partner. You are welcome to either work with the same partner you had for the previous homework, or you can choose a new partner for this assignment.
When you submit the assignment for grading only one partner needs to upload the project to Canvas. Be sure to attach a comment telling me who your partner was for this project.