1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
harina [27]
3 years ago
11

Write a Java program which reads a text file and writes the content into a new file. During the read-write process, convert all

the upper case letters into lower case ones. In other words, your programming task is to create a new file with the same content of the original file, only that all the upper case letters are converted into lower case ones in the new file.
Computers and Technology
1 answer:
Veseljchak [2.6K]3 years ago
6 0

Answer:

Kindly go to the explanation part for the code you seek.

Explanation:

This is the Code to Copy:

package file;

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.DataInputStream;

import java.io.FileInputStream;

import java.io.FileWriter;

import java.io.InputStreamReader;

import java.util.Scanner;

public class file

{

public static void main(String []args)

{

try

{

System.out.print("Type a file name: ");

//declare scanner for keyboard input

Scanner reader = new Scanner(System.in);

//scan the input file name

String infilename=reader.nextLine();

//define file stream

FileInputStream fstream = new FileInputStream(infilename);

DataInputStream in = new DataInputStream(fstream);

//define the buffer reader

BufferedReader br = new BufferedReader(new InputStreamReader(in));

String outfilename = "output.txt";

FileWriter fileWriter = new FileWriter(outfilename);

//declare buffer writer for file write

BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);

String strLine,filename;

int status = 0;

int i=0;

//read lines one by one from input file

while ((strLine = br.readLine()) != null)

{

String temp="";

//for each character in a line

for(int k=0;k<strLine.length();k++)

{

char c;

c=strLine.charAt(k);

//if the character is uppercase

if(Character.isUpperCase(c))

//make the character lowercase and append it to the output line

temp +=Character.toLowerCase(c);

else

//character is not lowercase. append to the output line without changing it

temp += c;

}

//write the line to the file

bufferedWriter.write(temp+"\n");

}

//close the input file

in.close();

//close the output file

bufferedWriter.close();

}

catch (Exception e)

{

//System.err.println("Error: " + e.getMessage());

}

}

}

You might be interested in
Anyone got E-aqa login?​
pashok25 [27]

Answer:no

Explanation:

3 0
3 years ago
A maximum reading of _______ parts per million (PPM) of NOx under loaded driving conditions generally means that the vehicle wil
dangina [55]
The correct answer is <span>D. 1,000.</span>
7 0
3 years ago
Read 2 more answers
Maria wants to create an image for a Web page. Maria should use _____. help me
Inessa [10]
Graphics software
Hope it helps
8 0
3 years ago
Read 2 more answers
Code in Python
KIM [24]

You're setting the value of user_num to 20. Doing this won't allow the other test cases to run. Simply delete that line and your code should work. This is the code I wrote:

user_num = int(input())

while user_num>=1:

   user_num/=2

   print(user_num)

I wrote my code in python 3.8. I hope this helps.

4 0
3 years ago
In which job role would a course in 3D modeling help with professional career prospects?computer programmer
Aleks04 [339]
This would either be a multimedia artist or a web developer
7 0
3 years ago
Read 2 more answers
Other questions:
  • • Describe the steps in detail that the operating system performs to handle interrupts, including ISRs, the stack, and hardware?
    5·1 answer
  • In a _____ network, each device on the network is attached to a central server. If the server fails, then the other devices will
    8·1 answer
  • The video game machines at your local arcade output coupons depending upon how well you play the game. You can redeem 10 coupons
    14·1 answer
  • Which of the following would an NSA professional most likely need?
    5·2 answers
  • What is the role of the W3C? Group of answer choices oversee research and set standards for many areas of the Internet supervise
    10·1 answer
  • How are web design &amp; web development different from each other?
    9·1 answer
  • (9/5)C+32 write QBASIC expessions for this​
    7·1 answer
  • After selecting a cell in the data range, what are some ways to create a table? Check all that apply.
    5·2 answers
  • What is considered appropriate dress for men and women in the workplace? Select all that apply.
    6·2 answers
  • We have studied machine cycle in class. Suppose that each of the four modules of machine cycle is taking 2 seconds. If there are
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!