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

Can someone please help me convert this C++ code to Java. void Setup:: parseData

ID: 3675111 • Letter: C

Question

Can someone please help me convert this C++ code to Java.

void Setup:: parseData(ifstream& in_stream){

string next_word;

int count = 0;

//reads the file next characters until the next whitespace until no more words and the count reaches the amount you'd like

while(in_stream >> next_word && count < 5000){

//adds the word to the array at the next available position

insertElement(next_word, count);

count++;

}

}

void Setup:: insertElement(string new_word_in, int position){

transform(new_word_in.begin(), new_word_in.end(), new_word_in.begin(), ::tolower);

   // creates the string memory

master_a[position] = new string;

//adds the word to the array

master_a[position]->assign(new_word_in);

length++

}

Explanation / Answer

public classFile { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the name of file"); String fileNamehere = br.readLine(); File file = new File(fileNamehere); if(file.length() == 0) { System.out.println("The File is empty"); }//read all the words from the file and store it into an array list namesd text else { BufferedReader fr = new BufferedReader(new FileReader(file)); ArrayList words = new ArrayList(); String[] line; String string; while((string=fr.readLine()) != null) { line = strring.split(" "); for(String word : line) words.add(string); } // Printing the content of words for(String word : words) System.out.println(word); } } }