Link to home
Start Free TrialLog in
Avatar of ohjava
ohjavaFlag for United States of America

asked on

Modifications in program to get the correct desired output

Hello,
In order to follow this question you will necessarily need to see the files being attached.

The problem
The original code and output are shown in the files under Lab4Original.zip
The modified code and resulting output are shown under Lab4dVersion1.zip

Description of the problem
The desired output should be ONLY the list of words sorted in alphabetical order (a to z). Case sensitivity and special characters should not matter.  

The given files are cisio.java, Index4.java, lab4d.java, Token.java and Node .java.
I have changed the extension on all of these to .txt.

The input file is lab4d3.txt. The given output file is Output_Given.txt. It is what you get when you run the given code.  

In order to get the desired output of alphabetically sorted words all I did was the following

1)Added an insert(t) method that inserts strings in a sorted manner in the Index4.java file.
2)Called this insert(t) method from the lab4d.java (main) file.

I did not modify anything else this far. I realize that there are things that are needed to be modified so that

1)there is no paragraph with lines numbers in the output and
2)I get the words in a more correctly sorted fashion than I have them now in my Version1 of the output.

You can see the results of these changes in Output_Version1.txt. This however is not the fully correct desired output. I have got only partial results.

Please note that you can see the changes I have made to the original files under the Lab4Verion1.zip folder. Once again I have had to rename Index4.java to Index4.txt and lab4d.java to lab4.txt. All other needed files you need to run in order to get the output that I am getting now are the same as in the original. These have not been changed, so I did not re-include them in this folder.
So if you can please examine this at leisure and get back to me as to what changes are needed in order to get the desired output(which is ONLY the alaphabetically list of words (the special characters and case do not matter), I will be grateful. In the meanwhile I am trying to solve this myself.

If anything is not clear please ask the question and I will clarify

Thanks,

Ohjava

Lab4Original.zip
Lab4dVersion1.zip
Avatar of ohjava
ohjava
Flag of United States of America image

ASKER

Increased the points as solving this question takes some work - have to open files and read them and examine output etc. Please take your time to examine question carefully.
ASKER CERTIFIED SOLUTION
Avatar of ohjava
ohjava
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ohjava

ASKER

Hello,
Please find attached the fianl version. It includes the desired output. The inout file here is Input4d3.txt and the output file is Output_version3.txt. Please run at the command line using
java lab4d < lab4d3.txt
Final.zip