Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to make quiz in line chatbot the example question is
The name of Indonesia's President since independence day:
1. _____
2. _____
3. _____
4. _____
5. _____
6. _____
7. _____
and when the user give input the third president, "Habibie". So the output will be like this.
The name of Indonesia's President since independence day:
1. _____
2. _____
3. Habibie
4. _____
5. _____
6. _____
7. _____

What I have tried:

I make code like this.

String[] Answer1 = new String[7];
Key1 = new String[]{"Soekarno", "Soeharto, "Habibie", "Gusdur", "Megawati", "SBY", "Jokowi"};
String[] Answer1 = new String[7];
Aswer1 = new String[]{" ", " ", " ", " ", " ", " ", " "};
int i;
for (i = 0; i < Key1.length; i++);
 
//Jump to else if
 
else if(textMessageContent.getText().equalsIgnoreCase("First Quiz")){
    replyText(messageEvent.getReplyToken(),"Nama-Nama Presiden RI: \n1. _____ \n2. _____ \n3. _____ \n4. _____ \n5. _____ \n6. _____ \n7. _____");
else if(textMessageContent.getText() == valueOf(Key1[i])) { 
    Answer1[i] = textMessageContent.getText(); 
    replyText(messageEvent.getReplyToken(), "The name of Indonesia's President since independence day:" + Answer1[i]); 


but actually does't work. Please give me the solution. I'm so confuse
Posted
Comments
Afzaal Ahmad Zeeshan 21-Dec-20 19:53pm    
And what is the problem?
20-087 MHD. REZA KURNIAWAN LUBIS 21-Dec-20 20:11pm    
There is no reply in the chatbot. The code doesn't work. I want the bot reply The name of Indonesia's President since independence day:
1. _____
2. _____
3. Habibie
4. _____
5. _____
6. _____
7. _____
when the user give input "habibie" and if the user give input "jokowi" in the next so the output will be like this.
1. _____
2. _____
3. Habibie
4. _____
5. _____
6. _____
7. jokowi
Richard MacCutchan 22-Dec-20 7:00am    
That code will not even compile. There is no structure to it, and you have a for statement that does nothing, and two else if statements without a preceding if.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900