In this PA, you will be writing a quizzing application. The quiz will be a four temperaments quiz, which can be taken to (roughly) determine one’s temperament.
The idea behind the four temperaments theory is that each person’s temperament falls into one of four categories: sanguine, choleric, melancholic, and phlegmatic. It isn’t always that case that a person’s temperament will fall solely into one of the four categories. For instance, it is likely that someone’s temperament could have both some melancholic and sanguine characteristics. However, one way to determine temperament is choose the category that most closely fits. The traits of the four temperaments are shown to the right.
It is possible to determine one’s temperament via a quiz. A decent example of one can be found here. If you’d like, you can take it for yourself! It only takes a few minutes.
For this programming assignment, you’ll be writing a quizzing application that is similar in nature to the quiz show on that website, but as an android application. For the purposes of this assignment, the Four Temperaments Quiz will be referred to as FTQ.
The flow of the application that should write should be as follows:
Of the 12 questions in the quiz, there will be 3 for testing for the level of each of the four temperament types. Each question should have a scale-of-5 response system: strongly disagree, partially disagree, neutral, partially agree, strongly agree. Each of those five answers will correspond to a 0, 1, 2, 3, or 4, respectively. Thus, the max score for each temperament is 3 * 4 = 12.
For instance, one of the tests for the melancholic temperament might be:
When making large financial decisions, I like to take my time, and weigh all of the options.
(Note: one of the traits of a melancholic is to be a deep thinker). Answering “strongly disagree” would earn the user 0 “points” in the melancholic category. However, answering “strongly agree” would add 4 “points” to their melancholic score.
I have provided four files, one for each temperament type, with 8 questions in each. You should add these files to your project, and read from them when you need to load questions. You should randomly select questions from the files (more on that later).
choleric.txt | sanguine.txt | melancholic.txt | phlegmatic.txt |
The quiz that you write should as 12 total questions. You should pick random questions from the files to ask. For the 12 questions, you should follow the order choleric, sanguine, melancholic, phlegmatic. In other words, select a random question from the choleric file, then one from the sanguine file, then melancholic, then phlegmatic, then repeat twice.
After a user has completed the quiz, they should be presented with a summary screen, with the results from their quiz.
The results should display:
See a few examples of the summary screen below:
First, create the welcome screen.
The minimum requirements for this are just a welcome message (with large text) and a large button to begin the quiz.
You can use the MainActivity
as the welcome Activity.
You can also rename the activity if you want.
Download the four txt files linked previously in the spec.
These should be added to res/raw
, so that they can be read in using the openRawResource
function.
Create another activity to be used for quizzing the user. Use the activity xml file to position the statement, the radio button selections, and the button to continue with the quiz. There will be a significant amount of code to add to this activity’s Java file. You’ll have to write code to:
After the user presses the “Next Question” button on the last question, this activity should determine the temperament scores and the temperament of the person.
These should be passed into the next activity (the summary activity) using the putExtra
function of the Intent
class.
Create yet another activity for the summary screen. The summary screen should accept two pieces of information from the previous activity that launched it (the quiz activity). Then, the activity should display the results of the quiz: The temperament, a description of the temperament, and the scores for each temperament.
See the gif of a full run of the temperament quiz app:
Target platform requirements are the same as for PA 1. As a reminder, you should target:
This PA is due on Friday, September 18, 2020, at 7pm. You should turn it in on Gradescope.
Use the Android Studio Zip feature to zip up the assignment. Then, submit the zip file to gradescope.
Note that there are not automated tests for this PA, so please ensure that your app works how the specification says it should!