2. Then it should prompt the user for the input file name of the file containing the data to sort.

3. If the program can't open the file or if no file name is entered (^d or ^z is entered for EOF), it should print an error message and exit.
4. The file will contain numbers that could be positive or negative integers or floating point numbers two numbers to a line.
5. The program should only handle the first 90 numbers in the file.
6. The program should read the numbers from the file into an array and then sort in ascending order (low to high) them.
7. If the program encounters a non-numeric value in the file, it should print an error message indicating the line number of the line containing the error and discard that input line in the file and go to the next line.
8. The program should print the sorted list of numbers, four numbers to a line in columns fifteen characters wide with four digits to the right of the decimal point.
9. After printing the sorted list, it should print:
o There were <number> numbers found in file <file name>.
o The largest number found was: <number>
o The smallest number found was: <number>
o The average of the values is: <number>
10. If there are no numbers in the file, the program should only print the following line
o There were 0 numbers found in file <file name>.
11. Include comments in your code (see project two for the required comment block formats) to explain what the code does.
12. See the examples below for spacing and formatting.
13. Your program should be well structured. The work should be done in functions, not in main. Include at least four functions that you will define.
14. The program can not use global variables except for a debug variable.

And the question is?

Sra

You better specify the programming language.

Programming language is C

What have you done so far, and what problems are you encountering?

To write a program that accomplishes these steps, you can follow these steps:

1. Define the required functions:
- `open_file`: This function should prompt the user for the input file name and try to open the file. If it fails to open the file or if the user enters "^d" or "^z" to indicate end-of-file, it should print an error message and exit.
- `read_numbers`: This function should read the numbers from the file into an array, handling the case where the file contains non-numeric values.
- `sort_numbers`: This function should sort the numbers in ascending order (low to high).
- `print_numbers`: This function should print the sorted list of numbers, formatting each number as a floating-point value with four digits to the right of the decimal point. It should print four numbers per line, with each number padded to fifteen characters wide.
- `calculate_stats`: This function should calculate the largest number, smallest number, and average of the numbers.
- `main`: This function should call the other functions in the appropriate order and print the required output.

2. Implement the `open_file` function:
- Prompt the user for the file name using the `input` function.
- Try to open the file using the `open` function.
- If opening the file fails or if the user enters "^d" or "^z", print an error message and exit using the `print` and `exit` functions.

3. Implement the `read_numbers` function:
- Initialize an empty list to store the numbers.
- Use a loop to iterate over the lines in the file.
- Inside the loop, use exception handling to handle the case where the line contains a non-numeric value.
- Convert each line to a floating-point number using the `float` function and append it to the list of numbers.
- Limit the number of values read to 90 by breaking the loop when the number of values reaches 90.
- Return the list of numbers.

4. Implement the `sort_numbers` function:
- Sort the list of numbers in ascending order using the `sort` method of the list.

5. Implement the `print_numbers` function:
- Initialize a count variable to keep track of the number of values printed per line.
- Use a loop to iterate over the numbers in the sorted list.
- Print each number using the `print` function, formatting it as a floating-point value with four digits to the right of the decimal point and padded to fifteen characters.
- Increment the count variable and print a newline character after every fourth number.

6. Implement the `calculate_stats` function:
- Use built-in functions such as `max`, `min`, and `sum` to calculate the largest number, smallest number, and sum of the numbers.
- Calculate the average by dividing the sum by the number of values.
- Return the largest number, smallest number, and average.

7. Implement the `main` function:
- Call the `open_file` function to get the file name and open the file.
- Call the `read_numbers` function to read the numbers from the file.
- Call the `sort_numbers` function to sort the numbers.
- Call the `print_numbers` function to print the sorted numbers.
- Call the `calculate_stats` function to calculate the statistics.
- Print the required output using the `print` function, formatting the numbers appropriately.

By following these steps and implementing the required functions, you can create a program that accomplishes the given tasks. Remember to add appropriate comments to explain the purpose and functionality of each part of the code.