Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete this assignment as written as a Java console application: Java How To Program, Late Objects, 11th Edition. Project 14.12 ( Searching Strings ) with

Complete this assignment as written as a Java console application:

Java How To Program, Late Objects, 11th Edition.

Project 14.12 (Searching Strings) with added functions.

Write an application in Exercise 14.11 that inputs a line of text and uses String method index0f to

determine the total number of occurrences of each letter of the alphabet in the text. Uppercase and

lowercase letters should be counted together. Store the totals for each letter in an array, and

print the values in tabular format after the totals have been determined.

Additional Functions: Use of a regular expression and the String.matches() method to validate that all

tokens from the String.split() method are alphabetic characters (display an error message for invalid input)

---------------------------------------------------------------------------

Here is my code. All I need help with is the second part (Additional Functions).

Please read my assignment don't copy and paste.

----------------------------------------------------------------------------

My Code:

public class SearchStrings { /** * * @param args */ public static void main(String[]args) { Scanner reader = new Scanner(System.in); //StringBuilder output = new StringBuilder(); System.out.print("Enter the string: "); String s1 = reader.nextLine(); int count=0;

for(char a='A';a<='z';a++) { //upperCase = lowerCase; count=0; char k=a;

for(int i=0;i

}

if(count>0) { System.out.println(a+":"+count); } } }

//System.out.println(output); }

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

Students also viewed these Databases questions

Question

How might investors and creditors use a statement of cash flows?

Answered: 1 week ago

Question

121. If X is uniformly distributed on [1, 3], find the pdf of Y X2.

Answered: 1 week ago