Home Answers Viewqa WebSevices vowels and consonants

 
 


Http Servlet
vowels and consonants
0 Answer(s)      a year and a month ago
Posted in : WebSevices

    import java.lang.String;
    import java.io.*;
    import java.util.*;

    public class Vowels{

    public static void main(String args[])throws IOException{

      File aa = new File("C:\\Temp1\\1.txt");
      File bb = new File("C:\\Temp1\\2.txt");
      File cc = new File("C:\\Temp1\\3.txt");
      String text=Vowels.getContents(aa);
     System.out.println(text);
      for (int i = 0; i < text.length(); i++) {
      char c = text.charAt(i);
      if (c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {

          Vowels.setContents(bb, c);
      }
      else
          if(c != 'a' || c != 'e' || c != 'i' || c != 'o' || c != 'u' || c != ' ')
          {
              Vowels.setContents(cc, c);  
          }

      }



    }

    static public String getContents(File aFile) {
        StringBuilder contents = new StringBuilder();

        try {
           BufferedReader input =  new BufferedReader(new FileReader(aFile));
          try {
            String line = null; 

            while (( line = input.readLine()) != null){
              contents.append(line);
              contents.append(System.getProperty("line.separator"));
            }
          }
          finally {
            input.close();
          }
        }
        catch (IOException ex){
          ex.printStackTrace();
        }

        return contents.toString();
      }

    static public void setContents(File aFile, char c)
    throws FileNotFoundException, IOException {
    if (aFile == null) {
    throw new IllegalArgumentException("File should not be null.");
    }
    if (!aFile.exists()) {
    throw new FileNotFoundException ("File does not exist: " + aFile);
    }
    if (!aFile.isFile()) {
    throw new IllegalArgumentException("Should not be a directory: " + aFile);
    }
    if (!aFile.canWrite()) {
    throw new IllegalArgumentException("File cannot be written: " + aFile);
    }


    Writer output = new BufferedWriter(new FileWriter(aFile));
    try {

    output.append(c);
    }
    finally {
    output.close();
    }
    }

    }  
View Answers









Related Pages:
vowels and consonants
vowels and consonants   import java.lang.String; import java.io.*; import java.util.*; public class Vowels{ public static void main(String args[])throws IOException{ File aa = new File("C
to read a file and seperate vowels and consonants to other files
to read a file and seperate vowels and consonants to other files  import java.io.*; public class alpha { public static void main(String[] args)throws IOException { try { FileInputStream fstream = new FileInputStream
vowels
vowels  program to count the number of vowels in a given array of characters   Hi Friend, Try the following code: import java.util....++; } } System.out.println("There are" + " " + count + " " + "vowels
vowels
vowels  how do u encryp vowels from given wordes?   import java.util.*; class EncryptVowels { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Enter
Count Vowels
Count Vowels   Read a string from the user, your program counts the number of vowels in the text and have it report a sum of each vowel found as well as the number of spaces. Make it in two classes
NUMBER OF VOWELS IN A WORD
NUMBER OF VOWELS IN A WORD  WRITE A PROGRAM THAT WILL INPUT A WORD THEN IT WILL DETERMINE THE NUMBER OF VOWELS PRESENT IN THE INPUTTED WORD
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
Programming - Count Vowels - main
Java: Programming - Count Vowels - main Problem Write a program that reads a string and displays the number of vowels in it. This main program program... a method to get the number of vowels. Details Loop. Read the input
ROTATE THE VOWELS IN A STRING!!! - Java Beginners
ROTATE THE VOWELS IN A STRING!!!  Hi Sir, My Question is to rotate the vowels, but not directly. First please read the question below... it changes the "vowel a to e", but doesn't change the rest of vowels, and i really
Java Count Vowels
Java Count Vowels       In this program you will learn how to count vowels in a String. Here you... the number of vowels from that String. Description of the code: In the program code
Java: Example - Count vowels
Java: Example - Count vowels This example method counts all vowels (a, e, i, o, u) in a string. //-------------------------------------------- countVowels() int countVowels(String text) { int count = 0; // start
full description of program code
); String vowels="",consonants=""; while(stk.hasMoreTokens...")||token.startsWith("u")){ vowels+=token+" "; } else...")||!token.startsWith("o")||!token.startsWith("u")){ consonants+=token
full description of program code
); String vowels="",consonants=""; while(stk.hasMoreTokens...")||token.startsWith("u")){ vowels+=token+" "; } else...")||!token.startsWith("o")||!token.startsWith("u")){ consonants+=token
using function
any sentence and print vowels and consonants sepratly   Here is an example that accepts a sentence from the user and display the vowels and consonants... a sentence from the user and display the vowels and consonants from that string
Programming - countVowels() method
one parameter, a string, and it returns the int number of vowels (a e i o u) in the string. Details Vowels. It should regard a, e, i, o, and u as the vowels. Case. It should handle both upper and lower case vowels. No I/O. As usual
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...*; import java.util.regex.*; public class Vowels { public static void main
string prgm
string prgm  write a java program which read a sentence and print occurence of each vowels in it seperatly
hi....
hi....  plzz sent me d code for counting vowels in a string... gui programme
STRING.....
STRING.....  plzz sent me d code for counting vowels in a string... gui programme
Java
Java  program to generate six letters in lower case and check if some of those letters are vowels..please help
vowel
word/string:"); String str=input.nextLine(); String vowels...'){ vowels+=Character.toString(ch[i])+" "; } } System.out.println("Vowels in the string: "+vowels
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
java  1) Take a string as input from command line and find the following: a) Length of the string b) number of vowels in it c) number of characters in it d) number of digits in it e) how many uppercase letters are present and how
java coding
java coding  i need to to a project in java and the title is file parsing. i need to read a file or if a particular file is given i have to count the no of vowels, pick out some terms, and to display the details about that file
html
html   HTML document with Javascript to count the number of vowels... MsgBox (str) { var chr = "" var nVowels = 0 //Counting all the vowels. for (pos = 0... " + nVowels + " vowels") document.write("<P>There were " + nVowels
Count number of "*"
++; } } System.out.println("The number of vowels in the given sentence
function method
all the vowels if chr is 'v' otherwise, finds its cube.   Here... vowels = "aeiouAEIOU"; String res=""; for( int i = 0... ); System.out.println("Vowels are: "+res); } } public static void main(String
Jsp Choose
anything else, inside a c:choose tag. Here we prompt the user to enter only vowels...;form method="post">Enter only vowels: <input type="text" name="choose... that the entered value is true: But if you enter any alphabet or number other than vowels
Java Programming using array
. A B C D E F G H I J The Consonants entered are B C D F G H
please help me to solve this question about array
please help me to solve this question about array  write a program thatt stores vowels (a,e,i,o and u)in an array. Ask the user to enter any character. The program should ignore the case of that character (uppercase or lowercase
working wit string - Java Beginners
java.util.regex.*; public class Vowels { public static void main(String[]args
Regex Exercises 2
that matches a series of vowels (a, e, i, o, or u). Match both upper
Java array - Java Beginners
Q6- writa a program to display all consonants in agivenline without using any
hello
hello  i have to write a program that stores vowels (a,e,i,o and u) in an array. ask the user to enter any character. the program should ignore the case of that character (uppercase or lowercase) and determine whether the entered
Creating Tree Structure using GWT
;TreeItem root = new TreeItem("Vowels");   root.addItem
Java String Examples
.   Java Count Vowels In this program you will learn how to count vowels in a String. Here you will be asked to enter a String of your own choice and then you will get the number of vowels from that String. Java
java - Java Beginners
and output a table giving the different numbers of vowels. (b) Is every Java
Java Notes: Table of Contents
vowels Example - Palindrome test Example - Replace

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.