I have to make a java code that takes jumbled words from an input file called jumbles.txt and sorts them in alpabetical order
1. Expect the user must to put a filename on the command line like this: C:\>java Lab4 jumbles.txt
2. Use that args[0] value as the name of the input file and open it with a BufferedReader
3. Load every line/word of that input file (one word per line) into an ArrayList of String
4. Sort that ArrayList of words
5. With every word of the ArrayList output a single line of output containing the word, a space, the canonical form of the word
expected output:
addej addej
ahicryrge acehhirry
alvan aalnv
etc.
here is the file words:
addej
ahicryrhe
alvan
annaab
baltoc
braney
celer
couph
cukklen
dica
dobeny
dobol
dufil
dupled
eslyep
ettniner
ettorp
genjal
gluhc
hartox
hoybis
hucnah
iddec
irrpo
kutbec
lappor
lasia
laurib
lubly
meefal
milit
mopsie
mycall
nekel
nokte
noper
nwae
nyegtr
perrim
preko
pudmy
pypin
rebisc
rodug
rpeoims
shewo
wardty
warllc
yaldde
copy to code:
Jumbled.java file is :
package normalClasses;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class Jumbled {
public static void main(String[] args) throws IOException {
//check the length of arguments
if (args.length < 1 )
{
//if arguments are not there show error
System.out.println("\nInput file missing in argument\n\n");
System.exit(0);
}
//define array list of words
ArrayList<String> words = new ArrayList<>();
//buffer reader for file read
BufferedReader infile = new BufferedReader( new FileReader(args[0]) );
//while not end of file
while ( infile.ready() )
{
//add string to arraylist
words.add(infile.readLine());
}
//sort the array
Collections.sort(words);
//now loop through list
for(int i=0;i<words.size();i++){
//get the word at index
String inString = words.get(i);
//convert string to char array
char tempArray[] = inString.toCharArray();
//sort char array
Arrays.sort(tempArray);
//create string from char array
String reverseString = new String(tempArray);
//show string and canonical from
System.out.println(inString+" "+reverseString);
}
infile.close();
}
}
jumbled.txt

output:
![E Console X <terminated> Jumbled [Java Application] C: addej addej ahicryrhe acehhirry alvan aalnv annaab aaabnn baltoc abclo](http://img.homeworklib.com/questions/ad466a60-48b0-11eb-b72d-f94910b06414.png?x-oss-process=image/resize,w_560)
make sure jumbled.txt file is in the same folder where class file is there.

I have to make a java code that takes jumbled words from an input file called...
I need help writing this code for java class. Starter file: Project3.java and input file: dictionary.txt Project#3 is an extension of the concepts and tasks of Lab#3. You will again read the dictionary file and resize the array as needed to store the words. Project#3 will require you to update a frequency counter of word lengths every time a word is read from the dictionary into the wordList. When your program is finished this histogram array will contain the following:...
The Assignment You do not get a starter file. You must write it completely from scratch. Your program should take two command args: a dictionary file and a jumbles file. For each jumbled word you must find all the matching dictionary words and print them after the jumbled word ion the line. Here is a tiny version of each input that you should test with until you are sure your code is correct: tinyDictionary.txt and tinyJumbles.txt and correct output for...
create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines. ** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the method, check if the...
I've been assigned to create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines. ** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the...
java
Write a program called Copy that accepts the names of an input file and an output file on the command line and copies the contents of the input file to the output file, for example, csc$ java Copy infile.txt outfile.txt
Having trouble with my code, it keeps giving me an error every time I run it. Can someone please help me understand what I'm doing wrong? *********CODE*************** // Java program to read the file contents, sort it and output the sorted content to another file import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class Datasort { public static void main(String[] args) throws IOException { File fin = new File("input.txt");...
java Program
Write a program called Copy that accepts the names of an input file and an output file on the command line and copies the contents of the input file to the output file, for example, csc$ java Copy infile.txt outfile.txt
Execute your program like this: C:\> java Lab4 10000ints.txt 172822words.txt Be sure to put the ints filename before the words filename. The starter file will be expecting them in that order. Lab#4's main method is completely written. Do not modify main. Just fill in the methods. Main will load a large arrays of int, and then load a large array of Strings. As usual the read loops for each file will be calling a resize method as needed. Once the...
Can someone please help me? I'm having trouble with this assignment and have been stuck trying to figure it out for over an hour. Here's the assignment details below: For this assignment, you will develop "starter" code. After you finish, your code should access an existing text file that you have created, create an input stream, read the contents of the text flie, sort and store the contents of the text file into an ArrayList, then write the sorted contents...
I need help with my code when I run my code running the wrong thing like this After downSize() words.length=60003 wordCount=60003 vowelCount=206728 this is my code here import java.io.*; import java.util.*; public class Project02 { static final int INITIAL_CAPACITY = 10; public static void main (String[] args) throws Exception { // ALWAYS TEST FIRST TO VERIFY USER PUT REQUIRED INPUT FILE NAME ON THE COMMAND LINE if (args.length < 1 ) ...