Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

******************************************************************************************** debug file *************************************************************************************************** package newpackage; /* * The FileReader and FileWriter classes read character streams. This program * reads a file called LoremIpsumIn.txt and

********************************************************************************************

debug file

***************************************************************************************************

package newpackage;

/* * The FileReader and FileWriter classes read character streams. This program * reads a file called LoremIpsumIn.txt and outputs a file called * LoremIpsumOut.txt. * * Your boss requested that you count the number of characters that * are in the file LoremIpsumIn.txt. In this exercise, add a counter that * counts the number of characters that are read from the input file. Your * output should look like the example below: * * "Number of characters in the file is: 2779" * * NOTE: You will need to change the path below in order to read/write the * file/s properly. */

import java.io.FileReader; import java.io.FileWriter; import java.io.IOException;

public class DebugMeOne { public static void main(String[] args) throws IOException {

int c; FileReader in = null; FileWriter out = null;

try { ///////////////////////////////////////////////////// // SAVE THE TEXTFILE LOREMIPSUM.TXT TO YOUR DESKTOP // AND CHANGE THE PATH "kohlm" TO YOUR LOGIN ID. // TO SAVE THE FILE, DOUBLE-CLICK TO OPEN IT AND THEN // GO TO FILE/SAVE AS TO SAVE THE FILE. // THIS IS THE PATH TO YOUR DESKTOP ON YOUR COMPUTER ///////////////////////////////////////////////////// in = new FileReader("C:\\Users\\kohlm\\Desktop\\LoremIpsumIn.txt"); out = new FileWriter("C:\\Users\\kohlm\\Desktop\\LoremIpsumOut.txt"); while ((c = in.read()) != -1) { out.write(c); }

} finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } } }

*********************************************************************

the LoremIpsumIn file

**********************************************************************

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a dui metus, eu pulvinar est. Curabitur nibh nunc, sagittis vel tincidunt a, mollis ac turpis. Aliquam fringilla nisi nec metus pellentesque auctor aliquam nisi egestas. Vivamus et ipsum non urna imperdiet faucibus. Vivamus dignissim accumsan convallis. Donec accumsan dolor id leo aliquet vitae gravida nulla dignissim. Donec eget arcu elit, ac viverra metus. Praesent risus neque, tempor in ornare ac, faucibus et dui. Donec ac bibendum dolor.

Cras egestas feugiat felis sit amet convallis. Sed id lacus at massa dictum pulvinar nec quis neque. Morbi a tortor in nunc aliquam tristique interdum eu nunc. Quisque vitae tellus mauris. Suspendisse ultricies ornare metus, non ullamcorper sapien fringilla sit amet. Curabitur hendrerit augue in nibh vehicula viverra. Praesent pellentesque dui eu felis feugiat euismod. Aenean vitae neque orci. Nulla ut purus magna, at adipiscing lacus. Integer ante sapien, sagittis in aliquet quis, commodo vel quam.

Sed vitae ligula nisl. Duis euismod lectus nec neque tincidunt id feugiat nisi aliquam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec laoreet, dolor id tristique fermentum, est enim malesuada elit, bibendum tempus libero ante eu nulla. Vestibulum nunc mi, fringilla id faucibus a, rutrum at ipsum. Donec sed aliquam neque. Fusce vulputate lobortis ante, eget vulputate ante vestibulum vitae. Curabitur condimentum feugiat dui rhoncus porttitor. Donec rhoncus, orci quis ultrices semper, dui elit fringilla dui, vitae consequat tortor eros nec eros.

Morbi libero dolor, faucibus at varius nec, mattis in leo. Pellentesque aliquam sem sed urna aliquam sed lacinia lectus dignissim. Pellentesque eu ultrices tortor. Vestibulum mollis, ipsum id laoreet fermentum, enim neque elementum elit, vel fermentum lectus orci vitae odio. Sed magna nisl, interdum nec gravida at, lacinia ut sapien. Integer non eros ante, ut placerat metus. Vivamus lorem arcu, tincidunt eget consectetur aliquet, vehicula eget sapien. Mauris sem neque, consectetur et bibendum et, viverra ut lacus.

Nam eget dui nunc. Sed mi enim, ultricies eu feugiat sit amet, blandit sit amet libero. In est leo, adipiscing facilisis pharetra sodales, tempor ut magna. Nullam sed enim ut metus tempus tempus. Curabitur euismod porta convallis. Etiam tortor velit, molestie ac condimentum eget, facilisis ut orci. Nunc quis dui a diam mollis interdum. Proin vehicula auctor quam, vel convallis dolor eleifend pharetra. Ut viverra nisi quis tellus imperdiet dignissim. Curabitur aliquet orci sed mauris elementum at eleifend massa condimentum. Curabitur porta, nisl in imperdiet fringilla, nisi nisl aliquam lacus, sed cursus est arcu ut mauris.

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago