Question: Project Description Implement a simple file reader using your programming language of choice. The user is queried for the filename of an input file assumed

Project Description

Implement a simple file reader using your programming language of choice. The user is queried for the filename of an input file assumed to be in the same directory as the executable reader. The reader reads a file containing a sequence of characters and outputs each character to the screen, including whitespaces, along with its line and character positions in index-one-based numbering. After reading and displaying the input file has been completed, the user is queried for a new filename to read, infinitely, until the user responds with quit or exit. Descriptive code comments and version control (i.e., Git) messages demonstrating progress within the completion of the project are required. You are not allowed to use any library or module that supports regular expressions in Java

Your program should include three procedures (each of which may be used in later projects): 1. nextChar(): reads the next character in the input file. (This will not return anything: it will cause the next character to be stored in memory.) 2. currentChar(): returns a string containing the character that was just read. 3. position(): returns a string containing the line and column integers separated by a colon character.

The main program should have a loop for reading the input and printing the characters as follows: nextChar(); while ( currentChar() != end-of-text ) { print ( position() + + currentChar() ); nextChar(); }

Every character from the text file should be outputted to its own line on the screen in the following format: currentLine() + : + currentColumn() + + currentChar()

For example, for an input file containing the following text: Hello COSC 333!

The reader should produce the following output: 1:1 H 1:2 e 1:3 l 1:4 l 1:5 o 2:0 2:1 C 2:2 O 2:3 S 2:4 C 2:5 2:6 3 2:7 3 2:8 3 2:9 !

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!