Hi. I am supposed to make a computer program that is designed to grade the classic myersBriggs test. There is a text file that i have to import the information from and then use it to determine the personailty with four dimensions. I am having major issues with this problem. Any help would be appriciated.
public class MyersBrigg { private static int JP = 0; private static int TF = 0; private static int SN = 0; private static int IE = 0; public static String[][] answers; public String[][] getArray() throws IOException { // Open the file PrintWriter outputFile = new PrintWriter("C:/MB.txt"); // Write the array elements to the file for (int row = 0; row < answers.length; row++) { for (int col = 0; col < answers[row].length; col++) outputFile.println(answers[row][col]); } // Close the file outputFile.close(); return answers; } public void getAnswers() { int row = 1; if ( row < answers.length); { int col = 0; if ( col < answers[row].length); { if (answers[row][col].equalsIgnoreCase("B")) { IE++; col++; } if (answers[row][col].equalsIgnoreCase("B")) { SN++; col++; } if (answers[row][col].equalsIgnoreCase("B")) { SN++; col++; } if (answers[row][col].equalsIgnoreCase("B")) { TF++; col++; } if (answers[row][col].equalsIgnoreCase("B")) { TF++; col++; } if (answers[row][col].equalsIgnoreCase("B")) { JP++; col++; } if (answers[row][col].equalsIgnoreCase("B")) { JP++; col++; } } } row += 2; } public static String[] getPersonality(String answer) { // Create String Array object String[] personality = new String[4]; if (IE < 4) personality[0] = "I"; else personality[0] = "E"; if (SN < 5) personality[1] = "S"; else personality[1] = "N"; if (TF < 5) personality[2] = "T"; else personality[2] = "F"; if (JP < 5) personality[3] = "J"; else personality[3] = "P"; return personality; } public static String printAnswers(String answer) { int A_IE = 20 - IE; int A_SN = 20 - SN; int A_JP = 20 - JP; int A_TF = 20 - TF; String answers = A_IE + "A-" + IE +"B " + A_SN +"A-" + SN +"B " + A_JP + "A-" + JP + "B " + A_TF + "A-" + TF + "B"; return answers; } public static String printPercents(String answer) { String percents = "[" + IE/10 + ", " + SN/20 + ", " + JP/20 + ", " + TF/20 + "]"; return percents; } } and my main class is as follows public class TestResults { public static void main(String[] answer) { int row = 0; int col = 0; for (row = 0; row < MyersBrigg.answers.length; row++); { for (col = 0; col < MyersBrigg.answers[row].length; col++) System.out.println(MyersBrigg.answers[row][col]); row++; System.out.println(MyersBrigg.printAnswers(MyersBrigg.answers[row][col])); System.out.println(MyersBrigg.printPercents(MyersBrigg.answers[row][col]) + MyersBrigg.getPersonality(MyersBrigg.answers[row][col])); } System.out.println("There are no more test to score!"); } }
I am fairly new to this. and am getting an error in my main thread. first it was a nullPointerException. and then a no method error. Now i am gettin this
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at TestResults.main(TestResults.java:13)
Please help me guys!
JV