Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
Question
Book Icon
Chapter 30, Problem 30.17PE
Program Plan Intro

Count consonants and vowels

Program Plan:

  • Import the necessary packages into program.
  • Define the class named “Exercise30_17”.
    • Define the main method.
      • Using “if…else” condition, check the first argument. If the file name is incorrect then print appropriate error message.
      • Exit the system.
    • Assign the first argument value into variable “name_file”.
      • Assign the vowel set into variable using “HashSet<>” class.
      • Find the number of vowels and consonants using “Stream” class.
    • Define the method “toCharacterArray()” which takes array list as parameter.
      • Declare the character variable “ans” in type of character.
      • Using “for” loop, assign all list values into “ans[]”.
      • Return the value of “ans”.

Blurred answer
Students have asked these similar questions
write a code to search a name from a file and print out the name using c
ii) Write EXACTLY what is printed by the code in 2b here
has anybody tried to open a file, copy a function inside the program, and use it for a current program? If so could you show an example, nothing too complex

Chapter 30 Solutions

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)