Write a program (PersonalityTest.java) to score users responses to the classic M
ID: 3656754 • Letter: W
Question
Write a program (PersonalityTest.java) to score users responses to the classic Myers-Briggs personality test. Assume that the test has 70 questions that determine a persons personality in four dimensions. Each question has two answer choices that well call the A and B answers. Questions are organized into 10 groups of seven questions, with the following repeating pattern in each group:
The first question in each group (questions 1, 8, 15, ... 64) tells whether the person is Extrovert or Introvert.
The next two questions (questions 2 and 3, 9 and 10, 16 and 17, ..., 65 and 66) test whether the person is guided by his/her Sense or iNtuition.
The next two questions (questions 4 and 5, 11 and 12, 18 and 19, ..., 67 and 68) test whether the person focuses on Thinking or Feeling.
The final two questions in each group (questions 6 and 7, 13 and 14, 20 and 21, ... 69 and 70) test whether the person prefers to Judge or be guided by Perception.
In other words, if we consider extrovert/introvert (E/I) to be dimension 1, sensing/intuition (S/N) to be dimension 2, thinking/feeling (T/F) to be dimension 3, and judging/perception (J/P) to be dimension 4, the map of questions to their respective dimensions would look like this:
12233441223344122334412233441223344122334412233441223344122334412 23344 BABAAAABAAAAAAABAAAABBAAAAAABAAAABABAABAAABABABAABAAAAAABAAAAAABA AAAAA
The following is a sample input file of names and responses:
Betty Boop BABAAAABAAAAAAABAAAABBAAAAAABAAAABABAABAAABABABAABAAAAAABAAAAAABA AAAAA
Bugs Bunny aabaabbabbbaaaabaaaabaaaaababbbaabaaaabaabbbbabaaaabaabaaaaaabbaa aaabb
Han Solo
BA-ABABBB- bbbaababaaaabbaaabbaaabbabABBAAABABBAAABABAAAABBABAAABBABAAB
The input file contains a name followed by his/her responses to the test. The answer to a question is case insensitive, and can be A, B, or where a dash represents that the person skipped that question. If less than 50% of a persons responses are B for a given personality dimension, the persons type for that dimension should be the first of its two choices. If the person answers B more than 50%, the persons type for that dimension is the second choice. If the person has the same number of As and Bs for a dimension, give them an X (as with Han Solo).
Ask the user to enter the input filename and check if the file exists. If yes, process the file. Otherwise, ask the user again to enter the input filename until a correct name is entered. You may assume that the input file contains no errors and that nobody has skipped all questions for a dimension.
Given the above input file, the resulting output would be:
Betty Boop
1A-9B 17A-3B 18A-2B 18A-2B [90%, 15%, 10%, 10%] = ISTJ
Bugs Bunny
8A-2B 11A-9B 17A-3B 9A-11B [20%, 45%, 15%, 55%] = ESTP
Han Solo
2A-8B 9A-9B 11A-9B 15A-5B [80%, 50%, 45%, 25%] = IXTJ