File history.d1 contains a brief history of computing, Computer Engineering

File History.d1 contains a brief history of computing. There are no indentations in this file. Write a program to read this file, inserting five blank spaces at the beginning of each paragraph. You can recognize a paragraph because a blank line appears before the first line of each paragraph. Write the changed file on History.d2. In the program documentation, described the loop(s) used as count - controlled or event -controlled.

  • Use the following loop as a model:

// Application IOLoop counts the number of blanks per line
// and the number of lines in a file
import java.util.Scanner;
public class IOLoop
      public static Scanner inFile;
      public static PrintWriter outFile;
 public static void main(String[] args) throws IOException
        int lineCount = 0;
        int blankCount;
        int index;
        String inputString;
        inFile = new Scanner(new FileReader("history.dat"));
        outFile = new PrintWriter(new FileWriter("data.out"));
    while (inFile.hasNextLine())
     inputString = inFile.nextLine();
          blankCount = 0;
          index = inputString.indexOf(' ');
          while (index != -1)
            if (inputString.length() != 1)
              inputString = inputString.substring(index+1,
              index = inputString.indexOf(' ');
            else index = -1;
          outFile.println("Line " + lineCount + " contains "
            + blankCount + " blanks.");


Posted Date: 3/13/2013 8:52:22 AM | Location : United States

Related Discussions:- File history.d1 contains a brief history of computing, Assignment Help, Ask Question on File history.d1 contains a brief history of computing, Get Answer, Expert's Help, File history.d1 contains a brief history of computing Discussions

Write discussion on File history.d1 contains a brief history of computing
Your posts are moderated
Related Questions
Write explanatory notes on Microprocessor development system. Microprocessor development system: Computer systems have undergone many changes recently. Machines which once fi

Evaluation Functions: Evaluation functions calculate approximately the score which can be prove of guaranteed if a particular world state is reached. Same like in chess, evalu

Q. Explain the Message Passing Interface? The Message Passing Interface (MPI) is a universal benchmark for providing communication among multiple simultaneous processes on a di

Compute the number of Ethernet frames formed for a data of 64 KB IP packet. Following figure demonstrates the format of the Ethernet frame. Here maximum data into a frame is 15

Equivalences & Rewrite Rules - artificial intelligence: Along with allowing us to verify trivial theorems, tautologies make us able to establish that definite sentences are say

Functioning of ROLAP happens concurrently with relational databases. Data and tables are stored as relational tables. To hold new information or data new tables are formed. Functio

Why Gateways are used during mail transfer? Email using SMTP effort best while both the sender and the receiver are on the internet and can hold TCP connections in between send

In critical computer applications the correctness of a delivered output and the continuity of the required service beside the speed of the used CPU are the most important measures

Image Capturing Download the following grey level 512x512 standard images in TIF format: a-Lena       b-Baboon     c-Bridge       d-Airfield Use Matlab to decrease the siz