Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in this peovram, the user should be able to hit enter multiple times to create a multiple lined sentence. The program should read all lines

image text in transcribedin this peovram, the user should be able to hit enter multiple times to create a multiple lined sentence. The program should read all lines as one sentence and should only execute when there is a period.
for example, a sentence entered by the user can include:
(a) A windmill has six blades.
(b) A
windmill has
six
blades.
Write a program that will read in a line of text and output a list of all the letters that occur in the text, Jalong with the number of times each letter occurs. End the line with a period that serves as a sentinel value. The letters should be listed in alphabetical order when they are output. Use an array of base type int of length 26, so that each indexed variable contains the count of how many letters there are. Array indexed variable O contains the number of Ja's, array indexed variable 1 contains the number of b's and so forth. Allow both uppercase and lowercase letters as input, but treat uppercase and lowercase versions of the same letter as being equal. Hints: You will want to use one of the methods toUpperCase or to LowerCase in the I wrapper class Character as described in Chapter 5. You will find it helpful to define a method that takes a character as an argument and returns an int value that is the correct index for that character, such as 'a' returning 0, 'b' returning 1, and so forth. Note that you can use a type cast to change a char to an int, like (int)letter. This will not get the number you want, but if you subtract (int)'a', you will then have the right index. Allow the user to repeat this task until the user says she or he is through

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

Nested Relations And Complex Objects In Databases Lncs 361

Authors: Serge Abiteboul ,Patrick C. Fischer ,Hans-Jorg Schek

1st Edition

3540511717, 978-3540511717

More Books

Students also viewed these Databases questions

Question

1. Describe the factors that lead to productive conflict

Answered: 1 week ago