Question
LANGUAGE IS JAVA * Should have 2 classes or more. 1 class is the starter code PromptBank, the other is your programs logic. * initial
LANGUAGE IS JAVA
* Should have 2 classes or more.
1 class is the starter code PromptBank, the other is your programs logic.
* initial greeting: Hello, my name is Eliza. What is your name?
The user should enter their name. Then the program should greet the user by name and prompt them for input.
* "Hello . Tell me what is on your mind today"
*Should use the 1st word and last word from that line to form another prompt to the user by plugging those words into a statement or question that will be randomly selected from the methods created that have BLANK 1 AND BLANK 2.
Example: BLANK 1 seems important to you, so does BLANK 2. Please tell me more
USER: Today is Friday.
PROGRAM: Today seems important to you, so does Friday. Please tell me more
* Starter code will then replace BLANK1 and BLANK2 with the words from the line
If the sentence the user enters ends with a ?, the program should prompt the user with a question built using the 1st word and last word of their line.
Example: Does BLANK 1 bother you? How about BLANK 2?
USER: Why do want me to talk about Friday?
PROGRAM:
Does Why bother you? How about Friday?
If the sentence the user enters ends with a !, the program should prompt the user with a statement that starts with WOW! Dramatic! followed by the rest of the statement built using the 1st word and last word of their line.
Example: WOW! Dramatic! BLANK 1 and BLANK 2 seem to be on your mind. Let's talk about it.
USER: No!
ELIZA: WOW! Dramatic! No and No seem to be on your mind. Let's talk about it.
If the sentence the user enters ends with a . or any other character, the program should prompt the user with a statement built using the 1st word and last word of their line.
Example: BLANK 1 seems important to you, so does BLANK 2. Please tell me more.
USER: I want to talk about the project.
PROGRAM: I seems important to you, so does project. Please tell me more.
* Process should be repeated until the user types EXIT as a response.When the user types EXIT the user should be asked if they want to run the session again.
* If they say yes, run the program from the beginning If they say no, Program says Goodbye, until next time
USER: EXIT
PROGRAM: Do you want to run the session again?
USER: No
PROGRAM: Goodbye, until next time
public class PromptBank { String [] questions; String [] statements; public PromptBank(){ //questions = new String[ ]; //initialize your array to the correct length to match your number of questions you populate it with //statements = //initialize your array to the correct length to match your number of questions you populate it with } public void populateStatementsArray(){ questions[0] = "Tell me more about BLANK1 and BLANK2"; questions[1] = "BLANK1 seems important to you, so does BLANK2. Please tell me more."; questions[2] = "BLANK1 and BLANK2 seem to be on your mind. Let's talk about it."; /*complete this method with your other statements using BLANK1 for word1 * and BLANK2 for word2 place holder */ } public void populateQuestionsArray(){ questions[0] = "Is there anything else about BLANK1 and BLANK2?"; questions[1] = "Does BLANK1 bother you? How about BLANK2?"; questions[2] = "Are BLANK1 and BLANK2 things you think about often?"; /*complete this method with your other questions using BLANK1 for word1 * and BLANK2 for word2 place holder */ } /* public String getRandomStatementTrunk(){ //fill in the method so it randomly selects the statement template //from the questions array ... hint use Math.random() to get the random index //so you can replace BLANK1 and BLANK2 with the appropriate words } */ /* public String getRandomQuestionTrunk(){ //fill in the method so it randomly selects the question template //from the questions array ... hint use Math.random() to get the random index //so you can replace BLANK1 and BLANK2 with the appropriate words } */ }
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