Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners accept sentence from user and print all word starts with vowel and end with consonent
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Nishant Jain
accept sentence from user and print all word starts with vowel and end with consonent
1 Answer(s)      3 years and 9 months ago
Posted in : Java Beginners


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


Advertisement
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
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
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
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
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
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
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
Java Print the all components
Java Print the all components  This is my code. Please tell me...; ImageIcon images; Container c; Employee_report f1; JButton print; String s,days...(td); np=ge-td; net=Double.toString(np); data = createData(); print=new
Accept command in Oracle
the Accept in SQLPlus. SQL> select * from user where username='&user_name' SQL> / Enter value for user_name: Deepak old 1: select username from... command in SQL Plus. The ACCEPT command in SQL Plus is used to take the input from
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
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
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
how to print all colors using awt
how to print all colors using awt  how to print all colors using awt
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 
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
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
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
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
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  
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
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
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
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
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
 

 

 

DMCA.com