Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Jul 2017 |
Last Sign in: | 231 Weeks Ago, 3 Days Ago |
Questions Answered: | 15833 |
Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
  I was wondering if you could help me with these 5 java problems. For # 5 I am awaiting the .java file and will upload as soon as possible.
import java.io.*;
/* A class that counts the letter frequency in a text
 * input stream. */
public class Count {
   /* Counts the letter frequency in a character
    * input stream. */
   public static count(String fileName) {
       /* initialize the frequency counts */
       int[] alpha = new int[];
       for (int i = 0; i <= alpha.length; i++) {
           alpha[i] = 0 /* Keep track of line numbers for error reporting. */
Â
       }
       try {
           LineNumberReader in2 = new LineNumberReader(
                   new FileReader(fileName));
           /* Read through to end of file. */
           while ((ch = in2.read()) != -1) {
               char
           }
           c2 = (char) ch;
           /* Update character counts. */
           if (Character.isLetter(c2)) {
               alpha[c2 - 'a']++;
           }
       } catch (Exception e) {
           System.err.println("Could not count file.");
       } catch (IOException e) {
           /* Handle input error. */
           System.err.println("Error reading line "
           in2.getLineNumber()
           ) ;
 System.err.println(e.getMessage());
       } finally {
           /* Make sure the stream is closed. */
           try {
               in2.close();
           } catch (Exception e) {
           }
       }
       /* Print out results. */
       for (int i = 0; i < alpha.length;) {
           System.out.println("'" + (char) ('a' + i) + "': "
                   + alpha[i]);
       }
   }
   /* Takes a list of files to process. */
   public static void main(string[] args) {
       for (int i = 0; i < args.length; i++) {
           count(args[i]);
       }
   }
}
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly