Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* Converts a string to lowercase, * and displays the string's length * as well as a count of letters */ /*The program should produce

* Converts a string to lowercase,

* and displays the string's length

* as well as a count of letters

*/

/*The program should produce the following outupt once all the bugs are fixed.

* Output:

* In all lowercase, the sentence is: "debugging is fun!!!"

* The number of CHARACTERS in the string is: 19

* The number of LETTERS is: 14

*/

public class LowerCaseString

{

public static void main(String[] args)

{

String str = "Debugging is FUN!!!";//input string that needs to be converted to lowercase

int numLetters = 0;

//converts string to lower case and counts number of letters

int stringLength = str.length;

System.out.print("In all lowercase, the sentence is: \"");

for(int i = 0; i < length; i++)

{

char ch = Character.toLowerCase(str[i]);

System.out.print(ch);

if(Character.isLetter())

numLetters++;

}

//printing number of letters and characters

System.out.println("\"");

System.out.println("The number of CHARACTERS in the string is: " + stringLength);

System.out.println("The number of LETTERS is: " + stringLength);

}

}

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

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

ISBN: 3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Employ effective vocal cues Employ effective visual cues

Answered: 1 week ago