Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab Description Create a program that will store a list of Words and perform particular operations on the list of Words. EXTRA ADD ONS Write
Lab Description Create a program that will store a list of Words and perform particular operations on the list of Words. EXTRA ADD ONS Write methods to return the Word with the most characters and Word with the least characters. Maintain sorted order. All new items should be inserted in the proper position. Removing items should not change the alphabetical order Sample Data: one, two, three, touz, five, six, seven, alligator tun, tly. tour six, tines, ten, plus, eight alligator, chicken, dag, cat, pig. battalo Files Needed :: Hord.java Hords.java Sample Output: ordRunner.ava onc to, three, four,tive, six, seven, alligator] word with 2 vowels # 5 word with 3 vowels word with 4 vowels1 word with 2 chars0 word with 3 chars3 word with 4 chars = 2 word with 5 chars after renoving words with 3 chars Ithree, four, ive, seven, alligatoz nunber of vavels in the words renoved Eun, y, tour, six, times, ten, plus, eight word with 2 vowels # 3 word with 3 vowels word with 4 vowels word with 2 chars0 word with 3 chars word with 4 chars = 2 word with 5 chars after renoving words with 3 chars Eour, times, plus, eight nunber of vovels in the words zemoved3 alligator, chicken, dog, cat, pig, baffalo word with 2 vowels word with 3 vowels1 word with 4 vowels1 word with 2 chars0 word with 3 chars3 word with 4 chars0 word with 9 chars = 1 after renoving words with 3 chars alligator, chicken, baffalo nunber of vavels in the words renoved3 import static java.lang.System.; public class Word private String word; private static String vowels "AEIOUaeiou"; 1/only one public Word () public Word (String wrd) public void setWord (String wrd) public int getNumVowels0 int count-0; return count; public int getLength() return 0 public String tostring () return import java.util.scanner import java.util.ArrayList import java.util.collections import static java.lang.System. public class Words private ArrayList words; public Words() setwords( public Words (String wordList) public void setwords (String wordList) public int countwordswithXchars (int size) int count=0; return count //this method will remove all words with a specified sizelength /this method will also return the sum of the vowels in all words removed public int removewordswithXChars (int size) return 0 public int countwordswithXVowels (int numVowels) int count=0; return count public String toString) return ; import java.util.Scanner; import java.util.ArrayList; import java.util.collections; import static java.lang.System.* public class WordsRunner public static void main( String args) words test = new words ("one two three four five six seven alligator"); out.println (test); out.println("word with 2 vowels = "+test.countwordsithxvowels ( 2 )); out.println("word with 3 vowels"+test.countWordsWithXVowels (3)) out.printIn( "word with 4 vowels = "+test.countwordswithxvowels(4)); out.println("word with 2 chars"+test.countWordsWithXChars (2)) out.println("word with 3 chars"+test.countWordsWithXChars (3)) out.println("word with 4 chars"+test.countWordsWithXChars (4); out.println("word with 5 chars"+test.countWordsWithXChars (5)) int vowelsRemoved -test.removeWordsWithXChars (3); out.println("nafter removing words with 3 chars " + test) out .printIn(" number of vowels in the words removed-= " + vowelsRemoved); out.println("nln") //more test cases
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