Thursday 6 March 2014

Sorted and Printed!

The integers that I put into input.txt is sorted now!
The sorted list is printed into output.txt.
Strings will also do the same.

I found out that it still says isDouble=true when it's an integer, meaning that isDouble should be =false.
I'm also getting java.lang.ArrayOutOfBoundsException whenever I try to sort doubles, This problem might be because of the previous one (about doubles being set as true when they aren't, and are still true when they are doubles, so doubles is the problem though I don't see the problem yet and this assignment is already way over due...

Wednesday 5 March 2014

FalseTrueFalseTrueFalseTrueFalseTrue

Program properly tests to see if something is an integer or double now. Stupid mistakes all around made it not work...like having things in loops when they shouldn't be, among other things. A lot of reorganising of the code was needed.

Working on putting the sorting method into the program.
Am I supposed to have three different sorting methods since they all call a different type of array (integer array, double array, string array)?

Thursday 27 February 2014

Tracing Statements and Other Things

I put in a bunch of tracing statements inside the if statements of when I'm trying to figure out whether it's an integer or a double. So far they're working and helping me figure out whether my program is actually going to work properly.
I'm starting to do the if statements using different things now to test if it's an integer or not. Hopefully it will be better than what I had before.

Tuesday 18 February 2014

Output and Instructions

I'm not done the other parts of the program yet, but I started to create the variables that I'll need for outputting the sorted data into the output file called output.txt.
What I plan to output is the String variable sorted, which is what the data that has been sorted will be called.

I also made an instruction screen that tells the user what to type in when prompted so that the correct file will be opened.

Tuesday 11 February 2014

Arrays

So I realised that I should have a String array that includes everything inside the file that I'm reading in, and then have another array that will go through each line to determine if it's an integer, dobule, or string. Array size is determined by what number is on the first line (the number was inputted by the user beforehand). And when I run this I will get an out of bounds exception because that number is out of bounds, since it's outside of the loop. I don't know what  I'm supposed to do with that catch statement yet (as in make it disappear) since only the second line of the text is showing up.
Ex, this is what's inside the text file:
3
line one --> (but only this line here is prited)
line two
line three


Monday 3 February 2014

For Loop

Today I finished the for loop that will see whether the text being read is an integer, double, or string. Instead of making the if statements for when it is valid, I wrote the if statements for when certain things are invalid for that type. For example, if I want to see if it's an integer, I would make sure that there were no letters or decimals in the text.
It will turn the boolean for the correct type of text to true while the others will remain false.

Monday 27 January 2014

Start

I have started my flowchart.

I've also written the code that will read in a file that I called input.txt which will include the unsorted data, whether it's a string, integer, or double. Another file that I made is named output.txt which will include the sorted data.
The unsorted data displays in the consol window now.

Next is to work on figuring out what type of data it is and then using the appropriate type of array.