Write a functionally correct Java program to produce specified console and file output. Use…

Write a functionally correct Java program to produce specified console and file output. Use Scanner and File to read input from a file. Use of exception handling for File 10 Use arrays to store and manipulate collections related information. Understand the use of reference semantics used by arrays, for parameter passing Use methods to manage information flow and add structure to programs. Follow prescribed conventions for spacing, indentation, naming methods, and header comments. Background Note: You do not need to read this section to complete the assessment, but it provides some helpful context that may make the assessment easier to understand. In this assessment, you will be writing a program to process the results of a personality test known as the Keirsey Temperament Sorter. The Keirsey personality test involves answering 70 questions by choosing one of two answers. The Keirsey test measures four independent dimensions of personality: • Extrovert versus Introvert (E vs 1): 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 extrovert, 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 “1” is used for “Introvert”, the letter “N” is used for “iNtuition.” This program will process an input file containing the results of a personality test for a number of people and determine each person’s Keirsey personality type. The program will begin by printing a short introduction, and then asking the user for an input file to read. The program will then read the given input file and process the responses to the personality test in that file, printing the results to the console. Test Format The Keirsey test involves 70 questions, each of which can be answered either “A” or “B” (case-insensitively). Each question related to one of the four dimensions (see below), and each answer corresponds to one option or the other for that dimension. The “A” answers correspond to extrovert, sensation, thinking, and judging the left-hand types in the list above). whereas the “B” answers correspond to introvert, intuition, feeling, and perceiving (the right-hand types in the list above). Questions can also be skipped, indicated by a response of “-“. Notice the ‘A’s and ‘B’s can be lowercase also The 70 questions in the Keirsey test are organized in ten groups of seven questions each. The first question in each group (i.e. questions 1, 8, 15, etc.) is related to the Extrovert/Introvert dimension. The next two questions in each group (questions 2 and 3, 9 and 10, 16 and 17, etc.) are related to Sensation/iNtuition. The next two questions (questions 4 and 5, 11 and 12, etc.) are related to Thinking/Feeling. The final two questions in each group (questions 6 and 7, 13 and 14, etc.) are related to Judging/Perceiving. Each person’s responses will be provided in question order. That is, the first response is from question 1, the second response from question 2, and so on. As stated above, each response will be either “A” or “a” (for the “left-hand” response), “B” or “b” (for the “right-hand” response), or “-” (if the person skipped that question) Determining Personality Type For each of the four dimensions, we determine the percentage of responses the person gave for that dimension that were “B” (rounded to the nearest integer). Smaller percentages indicate the person is closer to the “A” personality type for that dimension, while larger percentages indicate the person is closer to the “B” side. For each person in the input file, your program to the “B” side. For each person in the input file, your program should output the person’s name, the percentage of responses they gave for each dimension that were “B”, and their overall personality type. See the sample output file below for the specific format. Make sure that the format and structure of both your console output and your file output exactly match the given logs. For example, consider the first person in the sample input file personality.txt, named Betty Boop. This person’s responses are as follows: Dimension # of A responses # of B responses %age B Result Extrovert/Introvert 1 9 90% I Sensation/iNtuituion 17 3 15% S Thinking/Feeling 18 2 10% T Judging Perceiving 18 2 10% J For each dimension, we count the total number of responses given, then determine the percentage of those responses that were “B”. Based on this percentage, we assign the person to one side or the other of the dimension. If the percentage is less than 50, we assign them to the “A” side (the first option in each pair); if the percentage is greater than 50, the person is assigned to the “B” side (the second option in each pair). So, for example, Betty Boop has 90% “B” responses in the E/I dimension, so she is assigned to Introvert. On the other hand, she has only 15% “B” responses in the S/N dimension, so she is assigned to Sensing. It is also possible for a person to have exactly 50% “B” responses. In this case, the person is evenly split between the two sides of the dimension, and they are assigned “X” for that dimension. (See the sample input file for examples of this.) Questions that were skipped (i.e. those that have a response of “- “) are considered as neither A nor B responses and should not be included at all in the percentage calculation. So, for example, if a person skipped the first question on the test, they would only have 9 responses for the E/I dimension, rather than 10. If 6 of their responses were B, their percentage of B responses would be 6/9 = 67%, not 60%. Input File Format The input file will consist of pairs of lines, with each pair representing a single person. The first line in the pair will contain a person’s name, which may include spaces. The second line will contain a sequence of 70 responses to the personality test questions. Each response will be either “A”, “B”, or “-“, and the responses will appear as a sequence of characters with no spaces. (See the sample input file for more details.) You may assume that the input file is valid according to the format described above. Specifically, you may assume that: the file exists • the file contains an even number of lines the second line in each pair contains exactly 70 characters, all of which are either “A”, “a”, “B”, “b”, or “-” each person’s responses includes at least one non-dash response for each of the four dimensions Development Strategy to be able to use the Scanner, and File classes in your code, you will need to include the following line of code at the beginning of your program (before your public class declaration); import java.util.*; import java.io.*; Hints The following suggestions and hints may help you be more successful on this assignment: The string returned from Arrays.toString matches the format in which you should output arrays in your program . You may want to initially “hard-code” the input and output filenames; in other words, you may want to just use fixed file names in your code rather than prompting the user to enter the file names • You can print arrays in a nice format using the Arrays.toString method. Remember that this method returns a String, but does not print anything on its own- you will need to print the result using one of the usual methods. • Percentages should be rounded to the nearest integer. You can do this using the Math.round method, but this method returns a double, so you will potentially need to cast the result to an int. You can do this using code like the following: int roundedPercent = (int)Math.round(percentage); . You should read all file and user input using the nextLine() method Required Methods To receive full credit, your program must include the following methods: • A method to compute the count of A and B responses for a single user • A method to determine the final personality type for a single user Your program must include these two methods, plus at least two others. Each of these methods must perform only the tasks indicated, and must not contain any repeated logic. Your program must also include at least two (2) other non-trivial methods besides main besides these two. (Therefore, your program should have a total of at least four (4) non-trivial methods. Each method should perform a single, coherent task and not do too much work. Here is a sample execution chart that you can refer to: //main method creates a names array and a response array of type String to store the names and the responses to the 70 questions. Calles populateArray and configure Results public static void runPersonality Testo // method to read the names into the names array and responses into the responses array from the file “personality.txt” W/ the data file contains 18 entries, consisting of 9 pairs *public static void populateArray(String[] names String | responses) // use the names array and responses to extract for each person, the number of ‘B’ responses for each of the personality traits *public static void configure Personality(String[] names, String [responses) W take in the string containing 70 responses for a given name and calculate the percentages of ‘B’ for each of the 4 traits #public static String process Response(String response, int #public static String processResponse(String response, int Opercentages) // calculate the percentage by diving the number of ‘B’s by the total number of valid responses (ie A and B exclude -). Be sure to round the answer &public static double process Numbers(int numbersOfBs, int total) W use the percentage to determine for each group, the appropriate letter &public static String processBs(double percentage, int typeNumber) #public static void displayResults(String name, int [1 percentages, String result) Using Arrays You are required to use arrays to store and process most of the data throughout your program. Specifically, you must use arrays to store the following data: You must use arrays and traversals for these parts of your program to receive full credit. the A/B response counts for each dimension • the percentage of B responses for each dimension You must also use array traversals (via for loops) to process the data and arrays and transform it from one form to another. See the diagram below for the steps you should take to process and transform the data throughout your program: Sample Output Betty Boop : [90, 15, 10, 10). ISTJ Snoopy : [30, 45, 30, 70] = ESTP Bugs Bunny : [20, 45, 15, 55) = ESTP Daffy Duck : [108, 6, 20, 6] – ISTJ The frunious bandersnatch: [86, 95, 75, 78) – INFP Sample Output Betty Boop : [90, 15, 10, 10) = ISTJ Snoopy : [30, 45, 30, 70) – ESTP Bugs Bunny : [20, 45, 15, 55] = ESTP Daffy Duck: [100, 6, 20, 6) = IST) The frunious bandersnatch : [86.95, 75, 78] = INFP Minnie Mouse : (67, 28, 32, 5) = ISTU Luke Skywalker : [89, 61, 26, 25) = INTJ Han Solo : [88, 50, 45, 25) = IXT3 Princess Leia : [80, 58, 50, 5] = IXX) User Input This program requires you to process user input, which you must do using a Scanner. All text input should be read using the next method in the Scanner class, not the nextLine method. You may assume the user always enters valid input. Specifically, you may assume that: the user will always enter a value of the correct type the user will always enter a single word when asked to play again all guesses will be integers in the expected range (i.e. at least 1 and no more than the current maximum) You should NOT make any assumptions about input not specified here. Class Constant Create constants to represent the number of personality types (4), the number of participants (9). The number of question groups (E7) Permitted Java Features For this assessment, you are restricted to Java concepts covered in chapters 1 through 7 of the textbook. In particular, you MUST use the Arrays and Files. You may use for and while loops as needed and methods with input parameters and return values.
Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!