Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program which reads a file and creates a file with the same contents of

ID: 3555721 • Letter: W

Question

Write a program which reads a file and creates a file with the same contents of all lower case letters. Keep in mind that other characters are not affected.

Create your own file to test your program. Your job is to set up the input and output files to have the program read from a file and write to a file. Here is a basic program that will accomplish what is desired:

import java.io.*;
class InputOutput
{
public static void main(String args[])throws Exception
{
FileReader fr = new FileReader("Exercise03.in");
FileWriter fw = new FileWriter("Exercise03.out");

Answer6

int ch;
ch = fr.read();
while(ch != -1)
{
if((char)ch>='A' && (char)ch<='Z')ch = ch +('a'-'A');
fw.write((char)ch);
ch = fr.read();
}
fr.close();
fw.close();
}
}

This is the question. The problem is, I do not really know what to do or how to start. Can anyone help me? What is the question actually asking and how do I solve it?

Explanation / Answer

import java.io.*; import java.util.Scanner; public class LowerCase { public static void main(String args[]) throws IOException { Scanner scanner = new Scanner(System.in); System.out.println("Enter input string"); String inp = scanner.nextLine(); String output = "output.txt"; File fileOut = new File(output); BufferedWriter bufferedWriter= new BufferedWriter(new FileWriter(output)); bufferedWriter.write(inp.toLowerCase()); System.out.println(inp.toLowerCase()); bufferedWriter.close(); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote