I'm doing a Java text based game as a course project.Everything is fine but the part where it shows a conversation, then gives you 2-4 options, then each actions will lead to different text and stats changes.For now I can only come up with declaring a string array to store all the text, looping through the text until the multiple choice is given, then declaring an int to store the choice of the player, switch the choice to give different text and stats bonuses.This is quite inefficient and takes a lot of lines, so I wonder if there is a better way to do that.int[] statsChanged = new int[] {0, 0, 0, 0};                   int i;String[] event = eventDial.getFirstNight();for (i = 0; i < 7; i++) {    say(event[i]);    next();}int choice = -1;while (choice > 2 || choice < 0) {    try {        say(event[7]);        choice = input.nextInt();    } catch (InputMismatchException e) {        next();    }    switch (choice) {        case 0:            say(event[8]); say(event[9]);            statsChanged[0] = 2;            break;        case 1:            say(event[10]); say (event[11]);            statsChanged[1] = 2;            break;        case 2:            say(event[12]);            break;    }}say(event[13]);return statsChanged;event is the string array that stores the text. statchanges stores all the bonuses to 4 main stats. next() is just an empty input. (input.nextLine())say(str) is System.out.println(String str);
Giving multiple choices that lead to different scenarios
java