Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer in java. also in relation to this work answer these questions: 1)what is the advantages of using an array? 2)what are the disadvantages

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
please answer in java. also in relation to this work answer these questions:
1)what is the advantages of using an array?
2)what are the disadvantages of using an array?
Objective: Write a program that analyzes a collection of words and sorts them in ascending order by the number of vowels, consonants, and the length of the word. Requirements: Functionality. (80pts) No Syntax Errors (80pts) Code that cannot be compiled due to syntax errors is nenfiunctional code and will receive no points for this entire section Do not user built-in array sorters (80p) *Using any built-in or automatic sorting methods (such as Amayesort) will result in 0 points for this entire section Set up the Project. (20pts) First download the driver file and the text file and include it in your project, Create a class and name it, cxactly. WordHelper Write method sortBy Vowels (20pts) This static method returns a sorted String array, takes in an array of Strings via a parameter, and ots them from smallest to largest by the number of vowels. A character's case does not matter, and you may assume that all words only contain alphabet characters and no digits or special symbols. Write method sortlyConsonants (20pts) This static method returns a sorted String array, takes in an array of Strings via a parameter, and sorts them from smallest to largest by the number of consonants. A character's case does not matter, and you may assume that all words only contain alphabet characters and no digits or special symbols. Write method sortByLength (20pts) This static method returns a sorted String array, takes in an array of Strings via a parameter, and sorts them from smallest to largest by the number of letters A character's case does not matter, and you may assume that all words only contain alphabet characters and no digits or special symbols. Coding Style (10pts) Code functionality organized within multiple methods other than the main method, and methods organized within multiple classes where appropriate. (spts) Readable Code (5pts) Meaningful identifiers for data and methods Proper indentation that clearly identifies statements within the body of a class a method, a branching statement, a loop statement, etc. All the above must apply for full credit Comments (10pts) Your name in the file (Spts) At least 5 meaningful comments in addition to your name. These must describe the function of the code it is near (Spes) Example Dialog: The original were list CURY ANY WIA tre guideline Lapalis stributor pit strese stehen constitutional condition import java.util.*; import java.io.*;//Used for file input and output public class WordSorterFrontEnd { //The file name to be read in the program's root directory. Be mindful that the program's directory is often times not the source directory public static final String FILE_NAME - * ./randomwords.txt"; public static void main(String[] args) { //Reads the given text file String words - readFile(FILE_NAME); 1/Sorts the words using various criteria String[] vowelSorted WordHelper.sortByVowels (words); String consorted WordHelper.sortByConsonants (words); String[] lenSorted - WordHelper.sortByLength(words); //Prints the results System.out.println("The original word list"); printstrarr (words); System.out.println(" The word list sorted by Vowels"); printStrArr (vowelSorted); System.out.println(" The word list sorted by consonants"); printStrArr(consorted): System.out.println(" The word list sorted by Length"); printStrArr(lenSorted): Returns an array of strings that correspond to words found * line-by-line in a file * @param filename the name and path of the file to be read * @return an array of Strings corresponding to each word found in the file public static String readFile(String fileName) { try //Creates a scanner for the file and then first counts each word Scanner fileScanner - new Scanner(new File(fileName)); int wordCount = 0; while(fileScanner.hasNextLine()) { fileScanner.next! int wordCount = 0; while(fileScanner.hasNextLine()) { fileScanner.nextLine(); wordCount++; if(wordCount

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago