Solved

Modifications in program to get the correct desired output

Posted on 2008-10-23
3
196 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

708 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

16 Experts available now in Live!

Get 1:1 Help Now