Machine Problem
Write a Java program to ask the user a string and then the program will count the number of lowercase letters in the given string by user.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
/*
* LowerCase.java
*
* Jake Rodriguez Pomperada, MAED-IT, MIT
* www.jakerpomperada.blogspot.com and www.jakerpomperada.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippines
*
* Machine Problem
*
* Write a Java program to ask the user a string and then the program will count the number
* of lowercase letters in the given string by user.
*/
import java.util.Scanner;
public class LowerCase_Letters {
private static long countLowerCase(String s) {
return s.codePoints().filter(c-> c>='a' && c<='z').count();
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println();
System.out.println("\tCount Lower Case Letters in Java");
System.out.println();
System.out.print("\tEnter a String : ");
String val_str = input.nextLine();
long count_LowerCase = countLowerCase(val_str);
System.out.println();
System.out.print("\tNumber of Lowercase Letters : " + count_LowerCase);
System.out.println("\n\n");
System.out.println("\tEnd of Program");
System.out.println();
}
}