Will estimate emotional state of some


Imagine, that you work for Facebook and you are to write a program that will estimate emotional state of some user. The only information you have about the user is the latest message he posted (a message is just some string). You know that people use smileys (for example, :-) or :-( ) a lot in their communications and you have the following idea: you want to count how many open and closed parentheses does the message contain and then if there are more open parentheses '(', then the person is sad
and if the message contains more closed parentheses ')', then the user is happy. But unfortunately, not all messages have enough parentheses to make a conclusion which will be trustworthy. If the message has less than 5 parentheses (total), you cannot make a good conclusion on user's mood.
So, to implement this idea you need to write a Java program, that asks user to enter a message (a message is just a string, one line of text that can contain spaces). Then your program should count how many open '(' and closed ')' parentheses does the message contain. If the total number of parentheses (open and closed together) is less than 5, then you need to print back the message "User's mood cannot be determined.", otherwise if the message contains more open parentheses '(' you need to print back the message "The user is sad.", if there are more closed parentheses ')' you need to print a message "The user is happy.", and _nally if you have the same number of open and closed parentheses you need to print "The user is calm."

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Will estimate emotional state of some
Reference No:- TGS0940303

Now Priced at $30 (50% Discount)

Recommended (91%)

Rated (4.3/5)