Solved

Modifications in program to get the correct desired output

Posted on 2008-10-23
3
197 Views
Last Modified: 2013-11-23
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
0
Comment
Question by:ohjava
  • 3
3 Comments
 

Author Comment

by:ohjava
ID: 22791838
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.
0
 

Accepted Solution

by:
ohjava earned 0 total points
ID: 22792686
Hello,
This is to let you know that I have made progress in solving the above question to a large extent.  
Once again it will be necessary to examine the files.

Compared with the code that was given at the start of this problem, the files that have been modified are Index4.java, Token.java and lab4d.java.

Now the output is as is shown in Output_Version2.txt file.

The only problem is the very first line. It is not supposed to be there. Can anyone find out why it is showing up? But for this I think I have got the output in the form that was desired. Please see original files and modified files attached (Version2) to see where I have made the changes.

Please note that lab4d3.txt is the input file. All the rest are .java files that have been renamed .txt. Of course Output_Version2.txt is the output I got when I ran lab4d on command line using  java lab4d < lab4d3.txt.

So once again my problem now is that the first line should not show up in the output but it is. If you can tell me why this is happening, the question can be closed.

Thanks,

Ohjava

Version2.zip
0
 

Author Comment

by:ohjava
ID: 22802083
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now