beingtopper.jkp@gmail.com
+91-7529019575
Free Demo

Being Topper

  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us

Being Topper

  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us
  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us

Being Topper

  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us
B.tech notesBCA NOTESEvent HandlingInformation technologyJava ProgramsPrograms/Algorithm

java program for counting vowels , consonants , digits and whitespaces …

Being Topper 17/03/2014 0 Comments

Java program for counting vowels , consonants , digits and white spaces

//this program is for counting vowels , consonants , digits and whitespaces ....
import java.awt.*;
import java.awt.event.*;
class EventTest implements ActionListener
{ Frame fr;
Button b1;
TextField tf1,tf2,tf3,tf4,tf5;
EventTest( )
{ fr = new Frame("myframe" );
fr.setLayout(null);
b1= new Button ("Calc") ;
tf1 = new TextField() ;
tf2 = new TextField() ;
tf3= new TextField() ;
tf4 = new TextField () ;
tf5 = new TextField () ;

tf1.setBounds( 50,50,100,50) ;
b1.setBounds( 50,120,50,50);

tf2.setBounds( 50,190,100,50) ;
tf3.setBounds( 50,260,100,50) ;
tf4.setBounds( 50,330,100,50) ;
tf5.setBounds( 50,400,100,50) ;

fr.add( tf1) ;
fr.add( tf2) ;
fr.add( tf3) ;
fr.add(tf4) ;
fr.add(tf5) ;
fr.add( b1) ;

b1.addActionListener( this );
fr.setSize(600,700);
fr.setVisible(true);
}
public void actionPerformed (ActionEvent e )
{
if ( e.getSource() == b1 )
{
String str1 = tf1.getText() ;
char ch[] = str1.toCharArray() ;
int j= ch.length; int dcount = 0 ;int dconsonant =0;int dvowel =0; int dspace = 0;
for ( int i = 0 ; i<j; i++ )
{
if ( ch[i] == '1'| ch[i]== '2' | ch[i]== '3'| ch[i]== '4'| ch[i]=='5'|ch[i]=='6'|ch[i]=='7'| ch[i]=='8'|ch[i]=='9'|ch[i]=='0')
dcount++;

else if ( ch[i] == ' ' )
dspace++ ;
else {
for (char c = 65 ; c<123 ;c++ )
{
if (c>90&c<97)
{
continue ;
}

else if ( c==65|c==97|c==69|c==73|c==79|c==85|c==101|c==105|c== 111|c==117 & ch[i]==c)
{ if (ch[i]== c){
dvowel++ ;
break; }
}

else
{
if (ch[i] == c)
{ dconsonant++;
break;
}
}

}

}

}
tf2.setText (" " + dcount);
tf3.setText( ""+dvowel );
tf4.setText( ""+dconsonant);
tf5.setText(""+dspace);
}
}
public static void main (String s[] )
{
new EventTest();
}

}
java programs
1123 Views
AboutBeing Topper
In Socials:
PrevJava program for event Handelling17/03/2014
Java program on Deadlock17/03/2014Next
Categories
Recent Posts
  • Vipin Khuttel Inspires Entrepreneurs at Networking Meet in Gurgaon
  • Vipin Khuttel Founder of Being Topper Recognized for Advancing Digital Literacy and Social Empowerment
  • Vipin Khuttel Organizes International Conference for Digital Excellence 2, Elevating the Future of Technology
  • India’s Top Occult Science Enthusiasts Gather at AgyatOnSearch – Awards & Seminar in New Delhi
  • India’s Leading Digital Marketer, Vipin Khuttel Interacted with Top Influencers of Delhi at BJP West Delhi’s Event

Copyright © 2025 Being Topper ® . All Rights Reserved