Answer To: his homework is included in your final grade and is scored out of 8 points . Instructions: Complete...
Aditya answered on Sep 22 2021
Final/CountLetter
package countletter;
import java.io.*;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import java.*;
public class CountLetter{
public static void main(String agrs[]) throws IOException
{
char[] alphabets = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int[] counts ={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int ch = 0;
File file = new File("d:\\output.txt");
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
while ((ch = br.read()) != -1)
{
char character = Character.toUpperCase((char)ch);
for(int i = 0;i<26;i++)
{
if(character==alphabets[i])
{
counts[i] = counts[i]+1;
break;
}
}
}
br.close();
for(int j =0;j<26;j++){
System.out.println("Number of "+alphabets[j]+"s "+counts[j]);
}
...