import java.util.Scanner;
public class QuWeiCeShi {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] personalityTraits = {"内向", "外向", "冷静", "热情"a};
String[] personalityTypes = {"INTJ", "INFJ", "INFP"};
int score = 0;
String personalityType = "";
System.out.println("欢迎参加性格测试!请回答以下问题,回答选项A计1分,选项B计-1分,选项C计0分:");
// 依次展示问题并获取用户输入
for (int i = 0; i < personalityTraits.length; i++) {
System.out.println("Q" + (i + 1) + ": 你更倾向于" + personalityTraits[i] + "?");
String answer = input.nextLine();
if (answer.equals("A")) {
score += 1;
} else if (answer.equals("B")) {
score -= 1;
} else if (answer.equals("C")) {
score += 0;
} else {
System.out.println("无效的回答!请重新输入。");
i--; // 重新回答该问题
}
}
// 根据得分计算性格类型
int typeIndex = (score + 6) / 8; // 根据得分计算类型索引
personalityType = personalityTypes[typeIndex];
System.out.println("你的性格类型是:" + personalityType);
}
}