Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

--JAVA PROGRAMMING LANGUAGE-- Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns

--JAVA PROGRAMMING LANGUAGE--

Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the number of vowels in the string, and another method that returns the number of consonants in the string. Demonstrate the class in a program that performs the following steps:

  1. The user is asked to enter a string.

  2. The program displays the following menu:

    1. Count the number of vowels in the string

    2. Count the number of consonants in the string

    3. Count both the vowels and consonants in the string

    4. Enter another string

    5. Exit the program

  3. The program performs the operation selected by the user and repeats until the user selects e, to exit the program.

CHANGES:

-- Instead of Vowels, you will be finding numbers and instead of consonants, you will be finding spaces. We will also be finding substrings. We will call our version "Numbers, Spaces & Substrings".

#2a should now say "Count the number of numbers in the string'

#2b should now say "Count the number of spaces in the string"

#2c should now say "Count the number of times a substring appears in the string" (ask user to give substring)

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

Step: 3

blur-text-image

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

What is the purpose of EDI?

Answered: 1 week ago

Question

Compare the current team to the ideal team.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago