Code Below:


import java.util.*;
class MyString
{
    String Str;
    MyString()
    {
        Str="";
    }
    void readString()
    {
        Scanner s=new Scanner(System.in);
        System.out.println("Enter a sentence");
        Str=s.nextLine();
    }
    void results()
    {
        System.out.println("The original sentence="+Str);
        Str=Str+" ";
        System.out.println("WORDS\tVOWELS\tCONSONANTS");
        String w="";
        int v=0,c=0;
        int len=Str.length();
        for (int i=0; i< len; i++)
        {
            char ch=Str.charAt(i);
            if (ch!=' ')
            {
                w=w+ch;
                ch=Character.toUpperCase(ch);
                if (ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
                v++;
                else
                c++;
            }
            else
            {
                System.out.println(w+"\t"+v+"\t"+c);
                w="";
                v=0;
                c=0;
            }
        }
    }
    public static void main()
    {
        MyString obj=new MyString();
        obj.readString();
        obj.results();
    }
}