Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To Do: You are to write a program in Go that opens a text file, imports all the data in the text file to your

To Do:

You are to write a program in Go that opens a text file, imports all the data in the text file to your program, takes out all the numbers out of the imported data and then exports the contents into a new text file. Open, read, edit, write.

Requirements:

  • Your program will take the name of the input text file by a command line argument.
  • Your program will need the following functions:
    1. The main function that calls all the rest of the functions, except error checking function, sends parameters needed to the functions and receives variables back from functions when needed.
    2. A function to open the file and read in the contents of the file.
    3. A function to parse out all numbers in the imported file data.
    4. A function to write the new data, without numbers back to the output file.
    5. An error checking function, many of these steps have function calls that return an error variable, that variable should be sent to this function, if there is no error it doesn't need to do anything, if there is an error it should be sent to the panic function (built in, you don't write panic).
  • The output file name should be taken from user input.

Cut and Paste Sample input:

T56544h7575475e 75754an5675477s87567w7567e8767676574r t5654o565654 7575757th675676e la75677s375475743t q56456u56546e546st7575ion5654 75747o754554f t3333333h55555e f6666i7r77s888t q999u999966764i55645434z w4354543i646546l7677l 6868b68686654e "G224445566oL444a36346n35120g"88.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions