Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Phase 1 Make a new project and class in Eclipse called R16, with a main method. Download the data file from here (https://www.cs.colostate.edu/~cs163/.Fall18/recitations/R16/src/input.txt). Set up

Phase 1

Make a new project and class in Eclipse called R16, with a main method. Download the data file from here (https://www.cs.colostate.edu/~cs163/.Fall18/recitations/R16/src/input.txt). Set up the Run Configuration so that R16 has the program arguments: input.txt output.txt This is the same as reading command line arguments from the terminal. Create two methods with the following signatures: public void readFile( String inputFile ){ } public void writeFile( String outputFile ){ } Within the main method, call the readFile method with the first command line argument (args[0]), then call the writeFile method with the second command line argument (args[1]).

Phase 2

Implement the readFile method to open the input file, print the type of the next token (string separated by white space or punctuation) and the token itself, as shown below. Your code should read tokens until the end of the file is reached, and it should close the file when finished. Handle the data types integer, double, and string. Exceptions should be handled as shown in class and in the recitation. Make sure your program successfully reads the input values and prints them. Remember that some types can be upgraded from a lower type to higher type. The output from the provided file (input.txt -> https://www.cs.colostate.edu/~cs163/.Fall18/recitations/R16/src/input.txt) should exactly match the following:

String: And String: you String: feel String: that String: you String: have String: exerted String: your String: very String: best String: efforts String: in String: the String: matter, String: do String: you? String: That String: you String: have String: exercised String: all String: of String: your String: considerable String: ingenuity? String: Albus String: Dumbledore String: to String: Harry String: Potter Integer: 1 Double: 0.1 String: @ Integer: 12 Double: 0.123 String: $ Integer: 123 Double: 0.1234 String: % Integer: 1234 Double: 0.12345 String: ^ Integer: 12345 String: & String: FALSE String: TRUE String: Computer String: Science Integer: 13579 String: ~ Double: 999.98 String: Whatever String: A String: B String: C 

Phase 3

Implement the writeFile method to open the output file, prompt the user with "Enter text:", then read input from the user via the keyboard, print the input to the file, and close the output file. When the user types stop (uppercase or lowercase) by itself on its own line, the method should terminate. Given this input from the console: Enter text: Hello! Here are some words. stop can be written here, but it still makes it in. so will this stop. stop! stop The output file should exactly match the following: Hello! Here are some words. stop can be written here, but it still makes it in. so will this stop. stop!

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Define turnover.

Answered: 1 week ago

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago