Given a string of text, count the number of occurrences of each vowel, consonant, punctuation (on the top row of the keyboard), numeric digit, and all other symbols. (See table below).
Here is the class skeleton:public class KeyCounts { /** * Constructor for objects of class KeyCounts * @param String of ascii characters */ public KeyCounts(String keys) /** Access the frequencies * @returns array the number of items counted in each category * [DIGITS, VOWELS, CONSONANTS, PUNCTUATION, OTHER] */ public int[] getCount() /** Calculate the total number of non-OTHER keys counted. * The implementation should iterate over the array * returned from getCount(). * @return sum of non-OTHER frequencies */ public int getTotal() }
Dec |
Char |
Category |
0 |
CTRL-@ |
|
1 |
CTRL-A |
|
2 |
CTRL-B |
|
3...26 |
CTRL-C...CTRL-Z |
|
27 |
CTRL-[ |
|
28 |
CTRL- |
|
29 |
CTRL-] |
|
30 |
CTRL-^ |
|
31 |
CTRL-_ |
|
32 |
||
33 |
! |
PUNCTUATION |
34 |
" |
|
35 |
# |
PUNCTUATION |
36 |
$ |
PUNCTUATION |
37 |
% |
PUNCTUATION |
38 |
& |
PUNCTUATION |
39 |
' |
|
40 |
( |
PUNCTUATION |
41 |
) |
PUNCTUATION |
42 |
* |
PUNCTUATION |
43 |
+ |
PUNCTUATION |
44 |
, |
|
45 |
- |
PUNCTUATION |
46 |
. |
|
47 |
/ |
|
48 |
0 |
DIGIT |
49 |
1 |
DIGIT |
50 |
2 |
DIGIT |
51 |
3 |
DIGIT |
52 |
4 |
DIGIT |
53 |
5 |
DIGIT |
54 |
6 |
DIGIT |
55 |
7 |
DIGIT |
56 |
8 |
DIGIT |
57 |
9 |
DIGIT |
58 |
: |
|
59 |
; |
|
60 |
< |
|
61 |
= |
PUNCTUATION |
62 |
> |
|
63 |
? |
|
64 |
@ |
PUNCTUATION |
65 |
A |
VOWEL |
66 |
B |
CONSONANT |
67 |
C |
CONSONANT |
68 |
D |
CONSONANT |
69 |
E |
VOWEL |
70 |
F |
CONSONANT |
71 |
G |
CONSONANT |
72 |
H |
CONSONANT |
73 |
I |
VOWEL |
74 |
J |
CONSONANT |
75 |
K |
CONSONANT |
76 |
L |
CONSONANT |
77 |
M |
CONSONANT |
78 |
N |
CONSONANT |
79 |
O |
VOWEL |
80 |
P |
CONSONANT |
81 |
Q |
CONSONANT |
82 |
R |
CONSONANT |
83 |
S |
CONSONANT |
84 |
T |
CONSONANT |
85 |
U |
VOWEL |
86 |
V |
CONSONANT |
87 |
W |
CONSONANT |
88 |
X |
CONSONANT |
89 |
Y |
CONSONANT |
90 |
Z |
CONSONANT |
91 |
[ |
|
92 |
\ |
|
93 |
] |
|
94 |
^ |
PUNCTUATION |
95 |
_ Underscore |
PUNCTUATION |
96 |
` Back quote |
PUNCTUATION |
97 |
a |
VOWEL |
98 |
b |
CONSONANT |
99 |
c |
CONSONANT |
100 |
d |
CONSONANT |
101 |
e |
VOWEL |
102 |
f |
CONSONANT |
103 |
g |
CONSONANT |
104 |
h |
CONSONANT |
105 |
i |
VOWEL |
106 |
j |
CONSONANT |
107 |
k |
CONSONANT |
108 |
l |
CONSONANT |
109 |
m |
CONSONANT |
110 |
n |
CONSONANT |
111 |
o |
VOWEL |
112 |
p |
CONSONANT |
113 |
q |
CONSONANT |
114 |
r |
CONSONANT |
115 |
s |
CONSONANT |
116 |
t |
CONSONANT |
117 |
u |
VOWEL |
118 |
v |
CONSONANT |
119 |
w |
CONSONANT |
120 |
x |
CONSONANT |
121 |
y |
CONSONANT |
122 |
z |
CONSONANT |
123 |
{ |
|
124 |
| Vertical bar |
|
125 |
} |
|
126 |
~ |
PUNCTUATION |
127 |
DEL (Delete) |