Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class encrypt{
- static String newwrd = "";
- static String wrd;
- encrypt(){
- }
- public static void main(){
- encrypt ob = new encrypt();
- ob.acceptword();
- ob.freqvowcont();
- ob.nextVowel();
- ob.disp();
- }
- void acceptword(){
- Scanner sc = new Scanner(System.in);
- wrd = sc.nextLine();
- wrd = wrd.toUpperCase();
- }
- void freqvowcont(){
- int c = 0;
- for(int i =0; i< wrd.length();i++){
- char ch = wrd.charAt(i);
- if(ch =='A'||ch =='E'||ch =='O'||ch =='I'||ch =='U'){
- c++;
- }
- }
- System.out.println("vowels:"+c+" consonants"+(wrd.length()-c));
- }
- void nextVowel(){
- int len = wrd.length();
- for(int i =0;i<len;i++){
- char ch = wrd.charAt(i);
- if(ch =='A'){
- ch = 'E';
- } else if(ch =='E'){
- ch ='I';
- }
- else if(ch =='O'){
- ch ='U';
- }
- else if(ch =='I'){
- ch ='O';
- }
- else if(ch =='U'){
- ch ='A';
- }
- newwrd += ch;
- }
- }
- void disp(){
- System.out.println(newwrd);
- newwrd ="";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment