Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

import java.io.*; import java.io.FileInputStream; public class MyDictionary { public int countCharacters(File myFile) { int charCount = 0; String data; try{ FileInputStream fStrm = new FileInputStream(myFile);

import java.io.*; import java.io.FileInputStream;

public class MyDictionary { public int countCharacters(File myFile) { int charCount = 0; String data; try{ FileInputStream fStrm = new FileInputStream(myFile); InputStreamReader fData= new InputStreamReader(fStrm); BufferedReader bReadLine = new BufferedReader(fData); while((data = bReadLine.readLine()) != null) { charCount += data.length(); } }catch(Exception ex){ ex.printStackTrace();} return charCount; } public int countWords(File myFile) { int wordCount = 0; String data; try{ FileInputStream fStrm = new FileInputStream(myFile); InputStreamReader fData = new InputStreamReader(fStrm); BufferedReader bReadLine= new BufferedReader(fData); while((data = bReadLine.readLine()) != null) { String[] wordList =data.split("\\s+"); wordCount+= wordList.length; } }catch(Exception ex){ ex.printStackTrace();} return wordCount; } public int countVowels(File myFile) { int vowelCount = 0; try{ String[] Numberofwords=null; FileReader fr = new FileReader(myFile); BufferedReader br = new BufferedReader(fr); String data; int fcount=0; while((data=br.readLine())!=null) { Numberofwords=data.split(" "); for(int i=0;i

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_2

Step: 3

blur-text-image_3

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students explore these related Databases questions

Question

Conduct a needs assessment. page 269

Answered: 3 weeks ago