Question: import java.io.*; import java.util.Scanner; public class Dictionary { public static void main(String[] args)throws IOException { File myfile = new File(Dictionary -1.txt); Scanner inputFile = new
import java.io.*;
import java.util.Scanner;
public class Dictionary {
public static void main(String[] args)throws IOException {
File myfile = new File("Dictionary -1.txt");
Scanner inputFile = new Scanner(myfile);
Scanner input = new Scanner(System.in);
System.out.println("Which word would you like to find?");
String word = input.nextLine();
int count = 0;
boolean bool = true;
while(inputFile.hasNext() && bool) {
String tempWord = inputFile.nextLine();
count++;
if(word.equals(tempWord)) {
bool = false;
}
}
System.out.println("Word was found at index " +count);
}
}
Note: The Java program above will search for a word in a file saved in my computer named Dictionary-1. Once it finds the word it prints out the index of its location from a list of 1,000 words.
I now need help in writing a Java program that will flip each word in the list of my file. For example:
Apple flipped is elppA
All the words in my saved file need to be flipped as above. This program is for intro to computer science. Could I have some help on how to write the program as simple as possible. Thank you, your help is greatly appreciated.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
