Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I'm trying to do this Java project with Eclipse, but cannot run input file, even though I created file with system . Please help

Hi, I'm trying to do this Java project with Eclipse, but cannot run input file, even though I created file with system . Please help me with that. Thanks.

image text in transcribed

Write a program that asks the user for the names of two files. The first file should be opened for reading and the second file should be opened for writing. The program should read the contents of the first file, change all characters to uppercase, and store the results in the second file. The second file will be a copy of the first file, except that all the characters will be uppercase. Use Notepad or another text editor to create a simple file that can be used to test the program.

2e import java.util.Scanner; 3 import java.io.*; l 4 6 public class Fieconvertec { 8 public static void main(String[] args) throws IOException 9 10 Scanner scan- new Scanner(System. in); System.out.print( Enter the First file name: "); String filename! = scan.nextLine(); File file new File(filename1); while(file.exists)) 12 13 14 15 16 17 18 19 20 21 System.out.println(filenamel " does not exist. Please try again."); filename! = scan.nextLine(); file-new File(filename1); 23 24 25 26 27 28 29 30 31 32 Scanner fileToScannew Scanner(file); Printwriter fileTowrite new Printwriter("text2.txt"); while(fileToScan.hasNext)) { fileToWrite.println(fileToScan.nextLine().toUpperCase()); 34 35 36 37 38 39 fileTowrite.close) fileToScan.close); 45

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions