Write a program which takes a string input, converts it to lower case, then prints the same string with all vowels (a, e, i, o, u) removed.

Hint: one good way to do this is to make a new String variable and add all the letters you want to print (i.e. everything except vowels) to it.

Sample Run:

Enter String:
Animation Rerun
nmtn rrn


NOTE: This is in Java :)

if you can do this... It will be helping me a lot for my Java Exam ....

Respuesta :

import java.util.Scanner;

public class JavaApplication66 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter String:");

       String vowels = "aeiou";

       String text = scan.nextLine();

       text = text.toLowerCase();

       String newText = "";

       

       for (int i = 0; i < text.length(); i++){

           char c = text.charAt(i);

           if (vowels.indexOf(c) == -1){

               newText += c;

           }

       }

       System.out.println(newText);

   }

   

}

This works for me. Best of luck.

Answer:

Scanner scan = new Scanner(System.in);

   System.out.println("Enter String:");

   String v = "aeiou";

   String t = scan.nextLine();

   t =t.toLowerCase();

   String nt ="";

   for(int i = 0; i < t.length(); i++){

   char c = t.charAt(i);

   if (v.indexOf(c) == -1){

   nt += c;

     }

     }

   System.out.println(nt);

   

 }

 

}

Explanation:

Good Luck!

ACCESS MORE