subject

First: write code that prompts the user for the name of a text file, opens that file if it exists and reads the file one line at a time printing each line to the screen. you must implement the file read in a try/catch block rather than throwing the exception on the main method. next: modify your code so that the program takes the name of two files from the command line, opens the first file if it exists for reading and the second file for writing and copies the text of the first file into the second file. as with the first step, you must implement this in a try/catch block with an appropriate error message in the catch block. next: complete the method reverse that takes a string and returns a new string that is the original string reversed. note that we did this method in the lab a few weeks ago, so if you have that code you can just paste it in here. next: modify your code so that instead of printing each line to the file, it prints the reverse of each line to the output file using your reverse method. finally: make a single change to your code so that instead of copying the file, it outputs the new file not just reversed, but with all characters transformed to uppercase letters. (hint: make use of string's touppercase() method for this).use the code skeleton below to start your code. create a new project and a new class named copyfile and paste the code skeleton into it. then look at the course notes on file i/o to fill in what you need in the skeleton./** * program to copy one file into another, using command line arguments * * @author your name here * @author your partner name here * @version date here * */import java. io. filenotfoundexception; public class copyfile { /** * returns the reverse of the input string instring. * * @param instring * the string to be reversed * @return the reverse of instring */ public static string reverse(string instring) { // todo - complete this function // todo - the following line is only here to allow this program to // compile. replace it and remove this comment when you complete // this method. return ""; } public static void main(string[] args) { //todo: prompt the user for a filename //todo: open the file and print each line to the screen. //todo: don't forget to close the file when you are done. try { } catch (filenotfoundexception e) { } }}to test this program you will need a text file to read. create a new text file in eclipse by going to new -> untitled text file. then paste in the following text: jabberwocky'twas brillig, and the slithy tovesdid gyre and gimble in the wabe; all mimsy were the borogoves, and the mome raths outgrabe."beware the jabberwock, my son! the jaws that bite, the claws that catch! beware the jubjub bird, and shunthe frumious bandersnatch! "he took his vorpal sword in hand: long time the manxome foe he soughtso rested he by the tumtum tree, and stood awhile in thought. and as in uffish thought he stood, the jabberwock, with eyes of flame, came whiffling through the tulgey wood, and burbled as it came! one, two! one, two! and through and throughthe vorpal blade went snicker-snack! he left it dead, and with its headhe went galumphing back."and hast thou slain the jabberwock? come to my arms, my beamish boy! o frabjous day! callooh! callay! "he chortled in his joy.'twas brillig, and the slithy tovesdid gyre and gimble in the wabe; all mimsy were the borogoves, and the mome raths outgrabe. -- from through the looking-glass, and what alice found there (1872).save this in the top-level of your project folder for this lab and name it "jabberwocky. txt". note that it should be in your project folder and not in the src folder inside the project folder. when you run your program enter that file name as your input file - if your code is correct it will display the whole file to the screen. once you have done that, modify your code so that it prompts for two filenames and makes a copy from your input file to your output file.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:00
You install teamviewer on your workstation at home so that you can ac ess it when on the road. how can you be assured that unknown users cant access your computer through team viewer?
Answers: 2
question
Computers and Technology, 23.06.2019 21:50
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
What is a sketch or blueprint of a web page that shows the structure (but not the detailed design) of basic page elements such as the logo, navigation, content, and footer?
Answers: 3
You know the right answer?
First: write code that prompts the user for the name of a text file, opens that file if it exists a...
Questions
question
Mathematics, 20.07.2019 14:10
Questions on the website: 13722367