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
How can i clip a picture to a question on the computer?
Answers: 1
question
Computers and Technology, 23.06.2019 01:20
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
To check whether your writing is clear , you can
Answers: 2
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, 16.10.2020 03:01
question
Mathematics, 16.10.2020 03:01
question
Mathematics, 16.10.2020 03:01
question
History, 16.10.2020 03:01
question
Social Studies, 16.10.2020 03:01
Questions on the website: 13722361