Given the String class and the Character class as shown in t

Given the String class and the Character class as shown in the following UML, write a program to perform the following tasks. Read a string from the console. Count the number of each letter \'a\' \'z) in the string, ignoring the cases. Display the results to the console. Returns the number of characters in this string. Returns the character at the specified Index from this string. Returns a new string that concatenate this string with string si. Constructs a character object with char value Returns the char value from this object Compares this character with another Returns true if this character equals to another Returns true if the specified character is a digit Returns true if the specified character is a letter Returns true if the character b a letter or a digit Returns true if the character is a lowercase letter Returns true if the character is an uppercase letter Returns the lowercase of the specified character Returns the uppercase of the specified character

Solution

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package javaapplication2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author Namburi Ramesh
*/
public class JavaApplication2 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String input=\"j\";
int[] result=new int[24];
  
char[] alpha={\'a\',\'b\',\'c\',\'d\',\'e\',\'f\',\'g\',\'h\',\'i\',\'j\',\'k\',\'l\',\'m\',\'n\',\'o\',\'p\',\'q\',\'r\',\'s\',\'t\',\'u\',\'v\',\'w\',\'x\',\'y\',\'z\'};
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //to read input from console
System.out.println(\"Enter the String \ \");
try {
input=br.readLine(); //reads the input from console
} catch (IOException ex) {
Logger.getLogger(JavaApplication2.class.getName()).log(Level.SEVERE, null, ex);
}
  
for(int i=0;i<alpha.length;i++){
for(int j=0;j<input.length();j++){
Character c=new Character(input.charAt(j));
  
if(alpha[i] == c.toLowerCase(input.charAt(j))){
result[i]++;
}
}
}
  
for(int i=0;i<24;i++){
System.out.println(alpha[i]+\" -- \"+result[i]); //print output to console
}
  
}
  
}

 Given the String class and the Character class as shown in the following UML, write a program to perform the following tasks. Read a string from the console. C
 Given the String class and the Character class as shown in the following UML, write a program to perform the following tasks. Read a string from the console. C

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site