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

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 6 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
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 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
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
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
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
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
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
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
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 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 pretty print XML from Java?
How to pretty print XML from Java?  How to pretty print XML from Java
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 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
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 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
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
remove all objects from NSMutablearray
remove all objects from NSMutablearray  Hi, How to remove all objects from nsmutablearray? Thanks   HI, Here is the code for creating NSMutablearray, adding objects and then removing all the objects: NSMutableArray
not picking request parameters from the front end - JSP-Servlet
not picking request parameters from the front end  hi, This is venkatramana. I am writing one small basic program. I am not getting proper output... you have enter in front end). but i am getting response as welcome to unicel
I want to put user guide in pdf and word in side WEB-INF and need to give link on the home page
I want to put user guide in pdf and word in side WEB-INF and need to give link on the home page  I want to put user guide in pdf and word formats in side WEB-INF (for security reasons, I want these documents visible after user
print from a-z, A-Z with exact order using for loop
print from a-z, A-Z with exact order using for loop  how to print from a-z, A-Z with exact order using for loop? Thanks for all concern
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
Determining the Sentence Boundaries in a Unicode String
Determining the Sentence Boundaries in a Unicode String In this section, you will learn how to determine the sentence boundaries in a unicode string. From the previous section, you all are aware of BreakIterator class. This class
Find Longest Word from the string using Java
Find Longest Word from the string using Java Here we are going to find the longest word from the string. For this, we have specified the string which... and allow the longest word to display. Here is the code
Advertisements
 

 

 

DMCA.com