accept sentence from user and print all word starts with vowel and end with consonent

accept sentence from user and print all word starts with vowel and end with consonent

Write a program to accept a sentence. Print all the words that starts with vowel and end with a consonant. e.g. input by user "the purpose of education is to replace an empty mind with an open one" Ist output of open one education empty is an an the purpose to replace mind with

and Second IInd output of education is an empty an open one the to replace mind with

View Answers

February 23, 2011 at 3:35 PM

Java accept sentence from user and print all word starts with vowel and end with consonant

import java.util.*;
class StringExample6 
{
    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        System.out.println("Enter string:");
        String str=input.nextLine();
        StringTokenizer stk=new StringTokenizer(str);
        String vowels="",consonants="";
        while(stk.hasMoreTokens()){
            String token=stk.nextToken();
            if(token.startsWith("a")||token.startsWith("e")||token.startsWith("i")||token.startsWith("o")||token.startsWith("u")){
            vowels+=token+" ";
            }
            else if(!token.startsWith("a")||!token.startsWith("e")||!token.startsWith("i")||!token.startsWith("o")||!token.startsWith("u")){
            consonants+=token+" ";
            }
        }
        System.out.println("Second Output: "+vowels.concat(consonants));
    }
}









Related Tutorials/Questions & Answers:
accept sentence from user and print all word starts with vowel and end with consonent
accept sentence from user and print all word starts with vowel and end with consonent  Write a program to accept a sentence. Print all the words that starts with vowel and end with a consonant. e.g. input by user "the purpose
accept integer from user
accept integer from user  Write an Java application that accepts 100 integer numbers from a user. The input should be in the range of 1-200. Error message needs to be displayed if user entered input which is not in this range
Advertisements
Find the percentage of words which starts with a vowel in a file
Find the percentage of words which starts with a vowel in a file   Question: Find the percentage of words which starts with a vowel in a file. Ex: Input: Contents of File1- There is an endless loop in the program. Output: Vowel
finout longest word in sentence
finout longest word in sentence  write a program , how to find out the longest word in a sentence using java   Hi Friend, Try...; } } LongestWord(){ String word = ""; for(int i=0;i<stringArray.length;i++){ if(i==0
viewing the ms word in print layout from jsp - Java Beginners
viewing the ms word in print layout from jsp  Hi all, I am trying to export ms word from jsp in print layout format.I used the code for converting into ms word but it is opening in web layout. My requirement
print word with max vowels
print word with max vowels  if suppose i hava entered a sentence and in that sentence i have to print a word which has maximum vowels in it.... i have tried it but i am not getting it...please help
Write a program in JAVA which accepts a sentence & displays the longest word in the sentence alongn with it length of the word.
Write a program in JAVA which accepts a sentence & displays the longest word in the sentence alongn with it length of the word.  **A program in JAVA which accepts a sentence & displays the longest word in the sentence along
vowel
vowel  display all the vowel from word/string   import java.util.*; class DisplayVowels { public static void main(String[] args... word/string:"); String str=input.nextLine(); String vowels
button to accept user input
button to accept user input  private void jButton1ActionPerformed... that accepts firstname, lastname and gender from user and insert to database... the radiobutton and spinner.The user input does not show on my Studentinfo.mdb
Display the word that begins with vowel using Java Program
Display the word that begins with vowel using Java Program In this section, we are going to separate the word that begins with vowels from the specified text... '.' or '?' or !. So first of all  we have replaced all these special
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time  I am new developer in .net,I Have requirement..like this ,when user pick date from date picker
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time  I am new developer in .net,I Have requirement..like this ,when user pick date from date picker
array accept all data type
array accept all data type  how can create array that accept all data type??? if we can solution it? how..   Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public
array accept all data type
array accept all data type  how can create array that accept all data type??? if we can solution it? how..   Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public
Finding the longest word in a user given string
Finding the longest word in a user given string  In java, accept a string from the user and find the longest word in it.   The given code finds the longest word from the string. import java.util.*; class LongestWord
Accept command in Oracle
how to use the Accept in SQLPlus.ADS_TO_REPLACE_2 SQL> select * from user... command in SQL Plus. The ACCEPT command in SQL Plus is used to take the input from...  ACCEPT User input ACC[EPT] variable [NUM[BER]|CHAR|DATE] [FORMAT format
from number to word
from number to word  i want to know weather there is any method that can be use in changing value from number to word. Example if i write ten thousand, it will automatically be written as 10000.   Java convert number
click a word and search it from a file
click a word and search it from a file  i want to link a word with a file and search it form the file by clicking it. what could the code for this process
Print Matchingwords using Regular expression
Print Matchingwords using Regular expression       This Example describe the way to print the matching word from the file using Regularexpression. The steps involved in 
java string vowel program
java string vowel program  java string vowel program   Please visit the following links: Display the word that begins with vowel Java Count Vowels
Java Print the all components
Java Print the all components  This is my code. Please tell me...; JLabel banner; ImageIcon images; Container c; Employee_report f1; JButton print... = createData(); print=new JButton("Print"); print.setBounds(300,550,100,20); c.add(print
write a java program for pagination which will be configured by end user
write a java program for pagination which will be configured by end user  write a java program for pagination which will be configured by end user
stop word removal from text file
stop word removal from text file  i need java source code for stop word removal from a text file
write a java program for pagination which will be configured by end user
write a java program for pagination which will be configured by end user  write a java program for pagination which will be configured by end user  
httpservletrequest print all headers
Information available from the client in Servlet Request header display in a jsp
httpservletrequest print all headers
Information available from the client in Servlet Request header display in a jsp
httpservletrequest print all headers
Information available from the client in Servlet Request header display in a jsp
httpservletrequest print all headers
at: Header Information available from the client in Servlet Request header
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
Modify the sales tax program to accept an arbitrary number of prices, total them, calculate the sales tax and print the total amount.
Modify the sales tax program to accept an arbitrary number of prices, total them, calculate the sales tax and print the total amount.  Modify the sales tax program to accept an arbitrary number of prices, total them, calculate
Search word from text file using Java
How to Search word from text file using Java In this section, we are going to search a word from the text file. For this, we have created a swing button. On clicking, it will open another window that will ask the user to enter name. When
to read number from user
to read number from user  1)print the positive equivalent of the number 2) check if the no is integer or not 3) find the square root of the number 4) find the cube of the number
how to match the key word from a text file
how to match the key word from a text file  p>Hi all, I have the code to match the key word and from the text. I have input like this reader.txt...); String[] words = text1.split(" "); for (String word : words) { String regex1
Java search word from text file
Java search word from text file In this tutorial, you will learn how to search a word from text file and display data related to that word. Here, we have... students. The example prompt the user to enter any student's name
How to remove paragraph from ms word
How to remove paragraph from ms word  Hi! I am using MS Word to edit my text but somehow i get paragraph sign on every line of my text. So, can any one please tell me how to remove paragraph from ms word?   CTRL+SHIFT+8
Count repetitions of every word from an input file
Count repetitions of every word from an input file  Hello..i got to know how can i count the repetitions of every word present in a specific input file?For suppose if i have a url log file which have time,url's,ip address etc
java vowel program - Java Beginners
java vowel program  Write a program to Print all the words that start with a vowel and end with a consonant. For example : Input :â??the purpose of education is to replace an empty mind with an open oneâ?? Output
retrive data from data base and print it in every page until logout
retrive data from data base and print it in every page until logout  ... the USER NAME through retriving from database.suppose from home page he go to next page that page also contain the USER NAME until he logout. all page are develop
How to pretty print XML from Java?
How to pretty print XML from Java?  How to pretty print XML from Java
how to print all colors using awt
how to print all colors using awt  how to print all colors using awt
print the sum of even number from 1 to 100
print the sum of even number from 1 to 100  how to print the sum of even number from 1 to 100 using for loops? Thanks
how to print from right to left in java????
how to print from right to left in java????   can anyone pls tell how to print from right to left in java
Manage end-user state and understand performance tradeoffs of using HTTP sessions
Manage end-user state and understand...; Manage end-user state and understand performance tradeoffs of using HTTP... to a servlet, originating from the same user at the same browser
ModuleNotFoundError: No module named 'nester_print_all'
ModuleNotFoundError: No module named 'nester_print_all'  Hi, My... named 'nester_print_all' How to remove the ModuleNotFoundError: No module named 'nester_print_all' error? Thanks   Hi, In your
find the first character is vowel or not
find the first character is vowel or not  hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2... wehter it contains a space any where 4)replace all the "a" with "e" 5) extract
how to print all possible combination that sum to zero??
how to print all possible combination that sum to zero??  Ã?Â.... Print all possible combinations that sum to zero Example Enter a num : 7 1... each of the digits so that the resultant sum is zero. Print all posible
How we delete a data of database from front end jsp page
How we delete a data of database from front end jsp page   I make a website and featch a data from data base and now i want that a delete button put... deleted from jsp page as well as from database.I used mysql and jsp. Please help me
Retrieve a list of words from a website and show a word count plus a specified number of most frequently occurring words
Retrieve a list of words from a website and show a word count plus a specified... int N = 25; //the number of word/frequency pairs to print //word pattern... the document text from the web (provided by utility class) 2.Filter the desired
How to insert image in sql database from user using servlet
How to insert image in sql database from user using servlet  pls tell me accept image from user and insert image in sql server 2005 database using servlet and jsp
Java Word Processor
with a vowel (a, e, i, o, u), then just add ?ay? at the end of the word. o if the word begins with one or more consonants, move all initial consonants (up to the first vowel) to the end of the word and add ?ay? at the end. o if the word

Ads