Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help! I need to create a Java class called Headlines, with the following

ID: 3635153 • Letter: P

Question

Please help!

I need to create a Java class called Headlines, with the following elements:

- Three instance variables that are arrays of type String. Each array should hold at least 12 Strings. The three arrays will hold data read from three different files, described below.

- A method that opens three input files (named settings.txt, actions.txt and people.txt – see attachments) and reads their data into the 3 arrays (put actions in the action bag, etc.)

- A method that generates and prints out “headlines” consisting of strings pulled randomly from each of the bags, in the following order: people, actions, settings: in other words, randomly choose one people string, then randomly choose one action string, then randomly choose one settings string, and print them all out as one string.

- A main method that creates a Headlines object, prints out a headline, then prompts the user to see whether or not to continue; the program should continue to run as long as the user chooses to see more, and terminates when the user chooses to quit.

Here are the file addresses:

/Users/ribbit/Desktop/actions.txt
/Users/ribbit/Desktop/people.txt
/Users/ribbit/Desktop/settings.txt

Thank you!!!

Explanation / Answer

//So I went ahead and made my own text files, tested, and it all works. //Let me know if you have any questions about my implementation. import java.io.*; import java.util.Random; public class HeadLines { private String [] actions, people, settings; private final int LENGTH = 12; private int line; public HeadLines() { line = 0; actions = new String[LENGTH]; people = new String[LENGTH]; settings = new String[LENGTH]; } public void readFiles() throws IOException{ String str; FileReader fr = new FileReader("/Users/ribbit/Desktop/actions.txt"); //FileReader fr = new FileReader("actions.txt"); BufferedReader br = new BufferedReader(fr); str = br.readLine(); while (str != null || line