So my teacher gets mad at me when I ask questions so I'm coming here for your help cause you guys a life savers :)

So what I understand about this project is we have a file with numbers and we have to make an array to read it. I really dont know where to start with this. I made a txt file.

Any tips would be really appriciated. Thanks Guys and Gals!!

These are his direction they are sooo helpful :|

Below is a simple form. Place your email address in the box, and press the submit button. This will produce the name of an array, the name of an input file, the name of an output file, and a list of integer numbers of which the first one will be an exact count of the remaining numbers in the list. So if the first number in the list is 500, there will be 500 additional numbers in the list.

Copy and paste the number data, including the count into a plain text file with the name of the input file given. Your mission, if you choose to accept it, is to write a console program ( NO GUI ). Open and read the first line of this input file and create an integer array with the name of the array given and a size to match the first line of the file. So if the first line of the file contains 500, the array will have 500 slots. Read the remaining numbers into the array. Write a method named sort, which takes the array as a parameter, and sorts it from low to high. When the sort is complete, open and write a file with the name of the output file, the count will be first, followed by the sorted list of numbers (one per line). Finally, write a simple loop to compute the average of the numbers in the list (not including the count). Output this average as the last line of the output file. Be sure to use a double data type for the sum and average variables.

6 Years
Discussion Span
Last Post by kramerd

You should start by trying to read the input file. Just write a program that opens the file, reads each line and prints them out. Test this to make sure it works.

Next, modify your program to create an array of ints based on the first number you read from the file. Store the remaining ints in your array. Then write a loop to print out the numbers in the array. Test this to make sure it works.

Next, write the sort method. Pass the array into the sort method. Print the array both before and after it has been sorted. Test this to make sure it works.

... Get the idea? If you just take one step at a time, you will eventually finish the assignment. Along the way, if you test something and it doesn't work, and you can't figure out how to fix it, then create a new thread with a specific question about what you have so far, what doesn't work (be as specific as you can be) and ask for help. Good luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.