Exercise 8.10. A word is said to be \"abecdarian\" if the letters in the word ap
ID: 663680 • Letter: E
Question
Exercise 8.10. A word is said to be "abecdarian" if the letters in the word appear in alphabetical order. For example, the following are all 6-letter English abecedarian words. abdest, acknow, acorsy, adempt, adipsy, agnosy, befist, behint, beknow, bijoux, biopsy, cestuy, chintz, deflux, dehors, dehort deinos, diluvy, dimpsy 8.12. Exercises 105 1. Describe a process for checking whether a given word (String) is abecedarian, assuming that the word contains only lower-case letters Your process can be iterative or recursive. 2. Implement your process in a method called isAbecedarianExplanation / Answer
Answer
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
public class Exercise {
public static void main(String[] args) {
System.out.print("Enter the String ");
try{
BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
String s = bufferRead.readLine();
if(isAbecedarian(s)){
System.out.println("The word " + s + " is said to be Abecedarian");
}
else {
System.out.println("The word "+ s + " is not Abecedarian");
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.