,。
Requirement
This assignment will give you practice with arrays and producing an external output file. You are going to write a program that processes an input file of data for a personality test known as the Keirsey Temperament Sorter. The Keirsey personality test involves answering 70 questions each of which have two answers. We will refer to them as the “A” answer and the “B” answer. People taking the test are allowed to leave a question blank, in which case their answer will be recorded with a dash (“-“).
The input file will contain a series of line pairs, one per person. The first line will have the person’s name (possibly including spaces) and the second line will have a series of 70 letters all in a row (all either “A”, “B” or “-“). Your job is to compute the scores and overall result for each person and to report this information to an output file.
The Keirsey test measures four independent dimensions of personality:
- Extrovert versus Introvert (E vs I): what energizes you
- Sensation versus iNtuition (S vs N): what you focus on
- Thinking versus Feeling (T vs F): how you interpret what you focus on
- Judging versus Perceiving (J vs P): how you approach life
Individuals are categorized as being on one side or the other of each of these dimensions. The corresponding letters are put together to form a personality type. For example, if you are an extravert, intuitive, thinking, perceiving person then you are referred to as an ENTP. Usually the letter used is the first letter of the corresponding word, but notice that because the letter “I” is used for “Introvert”, the letter “N” is used for “iNtuition.”
Remember that the Keirsey test involves 70 questions answered either A or B. The A answers correspond to extravert, sensation, thinking and judging (the left-hand answers in the list above). The B answers correspond to introvert, intuition, feeling and perceiving (the right-hand answers in the list above). For each of these dimensions, we determine a number between 0 and 100 and indicate whether they were closer to the A side or the B side. The number is computed by figuring out what percentage of B answers the user gave for that dimension (rounded to the nearest integer).
These numbers correspond to the answers given by the first person in the sample input file (“Betty Boop”). We add up how many of each type of answer we got for each of the four dimensions. Then we compute the percentage of B answers for each dimension. Then we assign letters based on which side the person ends up on for each dimension. In the Extrovert/Introvert dimension, for example, the person gave 9 “B” answers out of 10 total, which is 90%, which means they end up on the B side which is “Introvert” or I. In the Sensing/iNtuition dimension the person gave 3 “B” answers out of 20 total, which is 15%, which means they end up on the A side with is “Sensing” or S. The overall scores for this person are the percentages (90, 15, 10, 10) which works out to a personality type of ISTJ.
Some people will end up with a percentage of 50 in one or more dimensions. This represents a tie, where the person doesn’t clearly fall on either side. In this case we use the letter “X” to indicate that the person is in the middle for this particular dimension. The last two entries in the sample input file end up with X’s in their personality type.
Take a moment to compare the sample input file and the sample output file and you will see that each pair of lines in the input file is turned into a single line of output in the output file that reports the person’s name, the list of percentages and the personality type. You are required to exactly reproduce the format of this output file. You are also required to reproduce the sample log of execution. You will provide a short introduction and then ask the user for the names of the input file and output file.
If you are interested in taking the personality test yourself, you will find a link from the class webpage to an online form with the 70 questions. We will be making a special data file called bigdata.txt that includes data from students in the class.
To count the number of A and B answers for each dimension, you need to know something about the structure of the test. You will get the best results if you take the test without knowing about the structure, so you might want to take the test first before you read what follows. The test has 10 groups of 7 questions with a repeating pattern in each group of 7 questions. The first question in each group is an Extrovert/Introvert question (questions 1, 8, 15, 22, etc). The next two questions are for Sensing/iNtuition (questions 2, 3, 9, 10, 16, 17, 23, 24, etc). The next two questions are for Thinking/Feeling (questions 4, 5, 11, 12, 18, 19, 25, 26, etc). And the final two questions†☯㭩ⁱ†‱†‷⸬†
⁴†⁹⁴⁵†⁴⁴†⁹⁰⁰†
†⁴⸠‼⁵††††ㅹ㝩†⁰†⁴⁴†ⴠ†⁴†⡆†㉥Ɐ㌠ⱨ⤶⸠㱁⼠㹮൳㱥㹳⁂†⁷⁵⁴⸠⁂†††‶‼ †㱧⽥㸮ഠਖ਼㱯㌠㴠≵䥳ⵥⵯ≯㸠䥤†㱯⼠㍡㹳൴ਠ㱴㹲㱥㸠䉴†䉩†䉡䅳䈠䅩䅮䄺䄼䈯䅰䄾䄍䄊䄼䅰䄾䈼䅦䅩䅧䅵䉲䉥䄠䅣䅬䅡䅳䅳䈽䄢䅨䅩䅧䉨䅬䉩䅧䅨䉴䄠䅪䅡䉶䅡䈢䄾䈍䄊䄼䉴䅡䅢䅬䅥䄾䄍䈊䄠䄠䄠䄠䄼䅴䉢䅯䅤䅹䄾䄍䄊††䄼䅴䉲䈾䄍䄊䈠䈠䈠䈠䈠䄠䈠䄠䈠䄠䄠䄠䄼䅴䉤䄠䉣䉬䅡䅳䉳䈽䄢䅧䅵䅴䉴䉥䉲䄢䄾䄍䈊䄠䄠䈠䄠䄠䈠䄠䈠䄠䄠䄠䄠䈼䅰䅲䉥䈾䈼䉳䅰䅡䅮䈠䉣䅬䅡䉳䅳䈽䈢䉬䉮‱䈼†䐠†䐼‾䈼䅳䅰䅡䅮䄠ⵣ䉬䅡䅳䅳䄽䈢䅬䉩䅮䅥䄢䄾䄼䅳䉰䅡䄠䅣䅬䅡䉳䅳䈽䄢䅫䅥䅹䉷䅯䅲䉤䄢䄾䉮䅴䄼䄯䉳䅰䅡䉮䄾䄠䅰䅥䅲䅣䉥䅮䈠䄽䄠䄨䈼䅳⵰䉡䅮䄠䅣‽•†ⵍ䉡䉴䈮䅲䅯䉮䉤䉰䉥䅲䉣䉥䉮䉴䅡ⵧ䉥䈻䈼䈯䉳䉰䈾䈼䅢䉲䈠䈯䈾䈼䈯䅰䉲䉥ⴾ䈍䈊䈠䈠䈠䄠䈠䈠䈠䈠䈠䈠䈠ⴼ䈯䅴䉤䈾䈍䈊䈠䈠䈠䈠䈠䈠䈠†䴼 䴠 䉴䅢䉯䅤䄾䄍䈊䄼䈯䉴䉡䅢䅬䉥䄾䄍䈊䄼䅦䉩䅧䉵䅲䅥䄾䈼䅰䈾䄍䄊䄼䅰䄾䄦䅢䅳䅰䄻䈼䄯䅰䄾䈍䄊䄼䅰䈾䅔䅨䅩䅳䄠䉩䄠䉴䉨䅥䄠䅦䅩䅲䅳䅴䄠䅴䱭䈠䅦䅩䅬䅥䈮䈠䅙䉯䉵䄠䅤䅯䈠䉳䅯䄠䉢䅹䄠䉣ⵯ䅮䅳䅴䅲䅵䉣䉴䉩䅮䉧䄠䅡䉮䄠䉯䅢䅥䉣䉴䈠䅯䉦䈠䅴䉹䅰䅥ⴠ䅐䅲䅩䅮⁴䡓䉤䄠䅲䉩䅴䉩䉮䉧ⴠ䅷䉲䉩䅴䅥䄠䉴䅯䈠䉓䅹䅳䅴䉥䅭䈮䅯䅵䅴䄠䈨䉷䅩䉴䅨䄠䅰䉲䉩䅮䉴䄠䅡䉮†䱳䉭䅥䉮䉴䅳䄩䄮䈠䉓䉥䉥䄠䅳䅥䉣䉴䅩ⵯ䅮䄠䄶䄮䈴䄠䉯䉦䄠䉴䉨䅥䈠䉢䅯䅯䅫䈠䅦䅯䉲䄠䅥䅸䉡䉭䉰䅬ⵥ䅳䄮䈠䅉䅴䈠䅩䅳䄠䅡䈠䅧䅯䅯䅤䄠䉩䅤䉥䉡䈠䅴䅯†㱳⽥㹯㱵⽲㹴൰ੵ㱴㍴㵹≳ⵯⵯ≧㸠⸠㰠⽯㍴㹰൵ੴ㰠㹥㰠㸠䉡†䉹㩨㥥〠ⱴㅯ㕲Ɐ⁵ㅧとⱬ⁹ㄠぴ㵴䥤䩯⁵㩲㌮〼Ⱟ⁰㐾㔍Ⰺ‼㍰〾ⱙ㝵〠㵯⁵䕬䉡䉥㩲…㉳ぱⱵ㐻㕳Ⱐㅮ㕳ⱷ㕲㕳㵲䕭䐠䑬㩳ㅧ〠ちⰠ㙡ⱬ㈠はⱮ†㙮⁸㵴⁌䥩䨨
㩥†㡩㙮ⱥ†㥯㕦Ⱐ㝮㕰Ⱶ⁴㜠㡡㴠䥥䙵䴠†䵡㩩㘮㜼Ⱟ⁰㈾㠍Ⰺ‼㍰㈾ⱏ㕥㵦†䥴䨠⁴䱨㩩㡭㥩Ɱ㘠ㅦⱯ㈠㙴ⱨ㉳㔠㵯䥲䨠䡳㩯⁵㡡ひⱥ†㕴ひⱡ㑳㕦Ɐ㉭㕩㴠䥡䨠䱯㩴㡡のⱯ⁴㕨づⱲ㔠すⱯ⁵㔠⁴㵡䥴䩩⁴㱨⼠㹲㱩⽮㹨ൡੴ㰠㍡㴰∠ⴠⴠⵥ≷㹯⡵††⥥㱡⽣㌠㹤൩੭㱥㹯㱮㹷⁹††⁴䬠†䥧⁵䅶⁴䉨⁴⁰䉬†††⁵††㼠⁴†㽵㰠⽤㹲㱥⽮㹲ansformations:
You may assume that the input file has no errors. In particular, you may assume that the file exists, that it is composed of pairs of lines, and that the second line in each pair will have exactly 70 characters that are either A, B or dash (although the A’s and B’s might be in either uppercase form or lowercase form or a combination). You may also assume that nobody has zero answers for a given dimension (it would be impossible to determine a percentage in that case).
The sample input and output files provide just a few simple examples of how this program works. We will be using a much more extensive file for testing your program. As mentioned earlier, we will include data from people in the class to make this file.
Your program is likely to have the number “4” in several places because of the four dimensions of this test. You should introduce a class constant to make this more readable instead of using 4 itself. It won’t be possible, however, to change this constant to some other number and have the program function properly. The constant is helpful for documentation purposes, but it won’t make the program particularly flexible.
We will once again be expecting you to use good programming style and to include useful comments throughout your program. We are not specifying how to decompose this problem into methods, but we will be grading on the quality of your decomposition. That means you will have to decide how to decompose the program into methods. You should keep in mind the ideas we have been stressing all quarter. You don’t want t