Question

Hello, I can't upload a text file. So, Here is textFileTwo.txt ------------------------------------------------------------------------------------------------ Closed captioning and subtitling...

Hello, I can't upload a text file. So, Here is textFileTwo.txt

------------------------------------------------------------------------------------------------
Closed captioning  and subtitling are both processes of displaying text on a television, video screen, or other visual 

display to provide additional or interpretive information. 

Both are typically used as a transcription of the audio portion of a program as it occurs, sometimes including descriptions

of non-speech elements. 

Other uses have been to provide a textual alternative language translation of a presentation's primary audio language that

is usually burned-in  to the video and unselectable.

HTML5 defines subtitles as a transcription or translation of the dialogue, when sound is available but not understood by 

the viewer.  And defines captions as a transcription or translation of the dialogue, sound effects, relevant musical cues,

and other relevant audio information, when sound is unavailable or not clearly audible, for example, when audio is muted or

the viewer is deaf or hard of hearing.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Create a new Java project with a class named FileInformation that reads a text file named “textFileTwo.txt”.

Your project should print out the following information about the file:

  1. Number of words, where a word is defined as a string that does not contain any spaces.

For example the number of words in “Hi, I love Java” is 4.

  1. Number of commas.
  2. The first line that contain the word “deaf”.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the answer...

CODE:


import java.io.*;

class Stats {

   public static void main(String[] args) {
       BufferedReader file;
       try {
           file = new BufferedReader(new FileReader("textFileTwo.txt"));
           String s = file.readLine();
           int word_count=0,comma_count=0;
           while (s != null) {
               word_count++;
               for(int i=0;i<s.length();i++){
                   if(s.charAt(i)==' ')
                   {
                       word_count++;
                       // System.out.println(i);


                   }
                   if(s.charAt(i)==',')
                       comma_count++;
               }
               s = file.readLine();
           }
           System.out.println("Word count = "+word_count);
           System.out.println("Comma count = "+comma_count);
           file.close();
       } catch (IOException e) {
           System.out.println("fike not found ");
       }
   }
}

OUTPUT:

E C:\Users\sai\Desktop\Stats.java - Sublime Text (UNREGISTERED) Eile Edit Selection Find View Goto Tools Project Preferences

textFileTwo.txt

Hi, I love Java
deaf

If you have any doubts please COMMENT...

If you understand the answer please give THUMBS UP...

Add a comment
Know the answer?
Add Answer to:
Hello, I can't upload a text file. So, Here is textFileTwo.txt ------------------------------------------------------------------------------------------------ Closed captioning and subtitling...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT