IN JAVA Write a program that replaces each line of a file with its reverse. For example, if you run java Reverse HelloPrinter.java Create the output as HelloPrinterReverse.java. If the file HelloPrinter.java contains the text public class HelloPrinter { public static void main(String[] args) { // Display a greeting in the console window System.out.println("Hello, World!"); } } ?? then the contents are changed to retnirPolleH ssalc cilbup { )sgra ][gnirtS(niam diov citats cilbup { wodniw elosnoc eht ni gniteerg a yalpsiD // ;)"!dlroW ,olleH"(nltnirp.tuo.metsyS } } If there is a blank line in the input file, do not print it in the output file. If you run Reverse twice on the same file, you get back the original file. Create the output file as HelloPointerOriginal.java java Reverse HelloPrinterReverse.java If the input file doesn’t exist, throw the message “Input file not found. Please check an rerun the program”. Allow the user to enter the input file one more time. If the user enters an invalid file again, terminate the program. Use a try... catch statement.
IN JAVA Write a program that replaces each line of a file with its reverse.
For example, if you run java Reverse HelloPrinter.java Create the output as HelloPrinterReverse.java. If the file HelloPrinter.java contains the text public class HelloPrinter { public static void main(String[] args) { // Display a greeting in the console window System.out.println("Hello, World!"); } } ?? then the contents are changed to retnirPolleH ssalc cilbup { )sgra ][gnirtS(niam diov citats cilbup { wodniw elosnoc eht ni gniteerg a yalpsiD // ;)"!dlroW ,olleH"(nltnirp.tuo.metsyS } } If there is a blank line in the input file, do not print it in the output file. If you run Reverse twice on the same file, you get back the original file.
Create the output file as HelloPointerOriginal.java java Reverse HelloPrinterReverse.java If the input file doesn’t exist, throw the message “Input file not found. Please check an rerun the program”. Allow the user to enter the input file one more time. If the user enters an invalid file again, terminate the program. Use a try... catch statement.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images