Question: IN JAVA PLEASE Write a class called StringClassifier that displays information about the keystrokes in a string. The class should have the following members: The

IN JAVA PLEASEIN JAVA PLEASE Write a class called StringClassifier that displays information aboutthe keystrokes in a string. The class should have the following members:

Write a class called StringClassifier that displays information about the keystrokes in a string. The class should have the following members: The string attribute will contain a string value. It can be anything - numbers, letters, or special characters. fa In the mutator method, the string attribute is only set if there are characters in the programmer-supplied string. The letters and digits attributes will store the number of letters and digits in the string. The uppers and lowers attributes will each store the number of upper-case and lowercase letters in the string. The evens and odds attributes will each store the number of even digits and odd digits in the string. None of these data members require accessor/mutator methods, since they will be given their values in the classify() method, and their values can be viewed in the toString() method. The classify() method will examine the string attribute and store the following information in the other instance variables: The classify() method will examine the string attribute and store the following information in the other instance variables: - The number of keystrokes in the string. - The number of letters in the string. - The number of upper-case and lower-case letters in the string. - The number of digits in the string. - The number of even and odd digits in the string. The toString () method will return a string that shows the information about your string (see sample code and screen shots below for format). The following program can be used to test your class: import javax. swing. JOptionPane; public class Testclassifier \{ public static void main (String[] args) \{ String str = JOptionPane.showInputDialog(null, "Enter a sentence to classify.", "Sentence Input", JOptionPane.QUESTION MESSAGE); Stringclassifier classifier = new StringClassifier (str); JOptionPane. showMessageDialog (null, classifier.toString(), "String Information", JOptionPane. INFORMATION MESSAGE); 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!