Question
JAVA Program It's so common to hear people start sentences with I am (as opposed to Ren Descartes, who is famous for ending a sentence
JAVA Program
It's so common to hear people start sentences with "I am" (as opposed to Ren Descartes, who is famous for ending a sentence like that). The Department of Sociology might be interested in a study of the qualities that people believe they possess. With the careful use of hidden microphones and NUANCE's Dragon Speech Recognition software, it has been possible to obtain transcripts of several conversations. Let's see what people think of themselves ...
Write a program that repeatedly:
Reads a sentence (into a String object)
Checks if the sentences start with "I am " (Hint: Read about the startsWith method.)
If it does, then extract the substring starting at the 5th character, i.e., the substring containing the quality the person believes they possess. (Hint: Read about the substring method.)
Concatenate that substring onto a growing string containing all such qualities. (Hint: Just use +.)
When a string containing just a "." is entered the loop stops, and the string of qualities is output. Here's what a sample run should look like (with the keyboard input shown in italics) ...
Please enter sentences, . to end. Hello everyone I am very clever Most people are not I am good looking too I am really good looking You are ugly I am confident . The qualities are very clever, good looking too, really good looking, confident,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started