This project utilizes three new classes:
· Word - an immutable class representing a word
· Words - a class representing a list of Word objects
· WordTester - a class used to test the Word and Words classes.
WordTester (the application) is complete and only requires uncommenting to test the Word and Words classes as they are completed. The needed imports, class headings, method headings, and block comments are provided for the remaining classes. Javadocs are also provided for the Word and Words classes.
Word
The Word class represents a single word. It is immutable. You have been provided a skeleton for this class. Complete the Word class using the block comments, Javadocs, and the following instructions.
1. Add a String instance variable named word which will contain the word.
2. Complete the one parameter constructor to initialize the word instance variable.
3. Complete the getLength method to return the number of characters in the word.
4. Complete the getNumVowels method to return the number of vowels in the word. It should use the VOWELS class constant and String’s length, substring, and indexOf methods. Do not use more than one loop. Do not use any String methods that are not in the AP Subset.
5. Complete the getReverse method to return a Word with the letters of this reversed.
6. Complete the toString method to return the String word.
7. Uncomment the Word test code in WordTester and make sure that Word works correctly.
Words
The Words class represents a list of words. You have been provided a skeleton for this class. Complete the Words class using the block comments, Javadocs, and the following instructions.
1. Add a List instance variable named words which will contain the list of words. Be sure to specify the type of objects that will be stored in the List.
2. Complete the one parameter constructor to initialize the words instance variable. You will need to create the ArrayList and add each word to it. This would be a great place to use a for-each loop. Your code should not generate any warnings.
3. Complete the countWordsWithNumChars method to return the number of words with lengths of num characters.
4. Complete the removeWordsWithNumChars method to remove all words with lengths of num characters.
5. Complete the countWordsWithNumVowels method to return the number of words that have num vowels.
6. Complete the getReversedWords method to return an array of reversed words.
7. Complete the toString method to return the words as a String. You should utilize ArrayLists’s toString method.
8. Uncomment the Words test code in WordTester and make sure that Words works correctly.
WORDS CLASS:
Step by stepSolved in 3 steps
- Pythonarrow_forwardWhich is true? Group of answer choices A class can implement multiple interfaces A class can inherit from multiple classes A class can implement only one interface An interface can implement multiple classesarrow_forwardDevelop a set of classes for a college to use in various student service andpersonnel applications. Classes you need to design include the following:• Person—A Person contains a first name, last name, street address, zip code,and phone number. The class also includes a method that sets each datafield, using a series of dialog boxes and a display method that displays all of aPerson’s information on a single line at the command line on the screenarrow_forward
- Pythonarrow_forwardExercise 5 - Number to Word Make a new class in the Lab2 project called Num2wordthat prompts the user enter a number between 0 and 9 and then displays the corresponding word (i.e. "zero"for 0, "one"for 1, etc.). Use a switchstatement to do this. Include a default case that lets the user know they entered a wrong number. The switch statement has the following syntax: switch (variable) { case value1: // Code that should execute when variable==value1 break; // this prevents it from automatically going to the next case case value2: // Code that should execute when variable==value2 break; // this prevents it from automatically going to the next case default: // Code that should execute when variable has a value that didn't match the above }arrow_forwardDesign a class called Stopwatch. The job of this class is to simulate a stopwatch. It should provide two methods: Start and Stop. We call the start method first, and the stop method next. Then we ask the stopwatch about the duration between start and stop. Duration should be a value in TimeSpan. Display the duration on the console. We should also be able to use a stopwatch multiple times. So we may start and stop it and then start and stop it again. Make sure the duration value each time is calculated properly. We should not be able to start a stopwatch twice in a row (because that may overwrite the initial start time). So the class should throw an InvalidOperationException if its started twice. 1arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education