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) and determine whether the entered character is vowel or not.

View Answers

November 9, 2010 at 3:42 PM

import java.util.Scanner;

public class Example1 {

public static void main(String[] args) {
    char arr[] = { 'a', 'e', 'i', 'o', 'u' };
    String brr;
    boolean flag = false;
    Scanner sc = new Scanner(System.in);
    char ch;
    System.out.println("Enter any character:");
    brr = sc.nextLine();
    if (brr.length() > 1)
        System.out.println("It is not character. Please enter character");
    else {
        ch = brr.charAt(0);
        System.out.println("It is character. " + ch);
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == ch) {
                flag = true;
                break;
            }
        }
        if (flag)
            System.out.println(ch + " is vowel.");
        else
            System.out.println(ch + " is consonant.");
    }
}

}

Is this code is fruitful for you.

+++++++++ knapster +++++++++


November 9, 2010 at 4:25 PM

import java.util.Scanner;

public class Example1 {

public static void main(String[] args) {
    char arr[] = { 'a', 'e', 'i', 'o', 'u' };
    String brr;
    boolean flag = false;
    Scanner sc = new Scanner(System.in);
    char ch;
    System.out.println("Enter any character:");
    brr = sc.nextLine();
    if (brr.length() > 1)
        System.out.println("It is not character. Please enter character");
    else {
        ch = brr.toLowerCase().charAt(0);
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == ch) {
                flag = true;
                break;
            }
        }
        if (flag)
            System.out.println(brr + " is vowel.");
        else
            System.out.println(brr + " is consonant.");
    }
}

}









Related Tutorials/Questions & Answers:
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.... Please enter character"); else { ch = brr.charAt(0
help me to solve this question
help me to solve this question  Write a program that inputs a series of integers into an array. The numbers are in the range 0 to 100. Calculate and display : a) The Largest number b) The Smallest Number c)The sum of the numbers
Advertisements
help me to solve this question...
help me to solve this question...  Given below is a class definition... and then create an array name myLibrary of type Book with size n. Using loop, create n objects of type Book and put them in the array myLibrary after reading the title
help me to solve this question
help me to solve this question   A user needs to key in data into system in order to save data into array. The data are: a. Lecturer ID, Lecturer... that has been added into array with the following features: a. Edit the course
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1... 3023 mark) and manipulate it by reading information to an array of student...; } } int main() { int *array; int size; cout <<
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1... 3023 mark) and manipulate it by reading information to an array of student...; } } int main() { int *array; int size; cout <<
help me about to solve my qustion
help me about to solve my qustion   An employee receives 15 SR per hour for the first 8 hours of week. After 8 hours (overtime) his rate becomes 20 SR per hour . Write a java class that ask a user to enter the number of hours he
Please help me about maven2 plugin - Maven
Please help me about maven2 plugin  First, thanks you for your all tutorial. That are the best tutorial i've learned. Then, I want to ask you about... an error. I send you the image i capture the error Please help me
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   The Task Write a class whose objects will represent students... in case you change your mind about something and want to go back
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   Write a class whose objects will represent students.The class should have three... about something and want to go back to an earlier version
Please help me to solve these programs in Python - Java Beginners
Please help me to solve these programs in Python  1. Write a program that prints an n-level stair case made of text. The user should choose the text character and the number of stairs in the stair case
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  1) Copy one file content to other? 2) Count the number of words in a file
help me please
help me please   Hello I want helping for this question , Please Write a program that reads some friendsââ?¬â?¢ names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  Q 1) In a class first day 25 students are joined. After two days that total students will increased to 60. We can develop a program by using ArrayList concept
help me to solve this problem..
help me to solve this problem..  Given below is a class definition... and then create an array name myLibrary of type Book with size n. Using loop, create n objects of type Book and put them in the array myLibrary after reading the title
urgent...pleAse help me.....please!
urgent...pleAse help me.....please!  please help me urgent! how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
I really need help with this assignment question Please help me out Please
I really need help with this assignment question Please help me out Please  * Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about
please help me.
please help me.  I have three table in mysql,and i hava create a excel sheet and add this sheet.but my question is in every sheet i can display one one table result.how can i do
please help me.
please help me.  Please send me a code of template in opencms and its procedure.so i can implement the code. Thanks trinath
please help me.
please help me.  How to read a properties file in java with a suitable example. Please send me. Thanks Trinath   Please visit the following link: Java read properties file
please help me.
please help me.  Please send me the validation of this below link. the link is http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html Thanks Trinath
help me please
help me please  how can i do dictionary with the use of array code in java, where i will type the word then the corresponding meaning for that word will appear...thanks
please help me.
please help me.  How to move the edits.jsp in below link? http://www.roseindia.net/answers/viewqa/JSP-Servlet/9584-JSP-Servlet-Search-and-Edit.html
Please help me??
Please help me??  Question_1: Using one-dimension array of primitive... to declare, create and manipulate a one-dimension array of primitive type... two integer array called array1 and array2 3. For array1, set initial values
please help me.
please help me.  I have a jsp page under that i add a list box under i get the countries through my database. so how can i do
please please i wanna insertion sort program find calendar to array value (1000,5000,10000), please help me
Insertion sort program find calendar to array value 1000,5000,10000  program find calendar for insertion sort in jfram to array 1000
please help me
before. This name list should get from the database. Please help me. By the way, I'm...please help me  Dear sir, I have a problem. How to write JSP coding, if a user select a value from drop down list for example department, the another
Please help me.
Please help me.  Hi i am trinath in below there is a url.In that url there is a code of edit a jsp page.I understand that code but only one thing i not get it i.e; What is the work of "id".and what is the data type of id? http
please help me...
please help me...  write an application that print number in the following order using a FOR-Loop 1 2 3 4 5 2 4 6 8 10 3 6 9 1215 4 8 121620 5 10152025
please help me in these prog
please help me in these prog   create 2 jdbc programs including awt create 2 jdbc programs including swing create 2 jdbc programs including command line argument create 2 jdbc programs including io class 4 jdbc prog using
please help me to this problem..
please help me to this problem..  i wrote a program like keyboard... inside the JTextField) but i want to make this program to let me write where i clicked (i.e allows me to write any thing at the field where i clicked
Please help me out
Please help me out    Description* You are hired to develop a laptop inventory information system for Sheridan College in order to keep track of the information about the laptops lent to the students. Users can add or remove data
Please help me urgent...........
Please help me urgent...........  For what kind of a problem would use a Tree Set and not a Tree Map For what kind of a problem would use a Tree Map and not a Tree Set   Hello Friend,ADS_TO_REPLACE_1 If you want
Help me please!!! - Java Beginners
Help me please!!!  im badly needing the complete code for this project in java!!! can you please help me???!!! it is about 1-dimensional array... the answers 8Hours from now!!! Kindly help me!! please!!please!!! NOTE
Please help me
Please help me  program for when a user enter his card number, it has to create default security pin in the database
Please help me
Please help me  Hi Sir, please send me the code for the following progrems... 1) all sets are integer type: input: set1={10,20,30,40} set2={15,25,35} output: union={10,15,20,25,30,35,40} 2) input: "Hi what
Please Help To Solve My Problem
Please Help To Solve My Problem  PHP I Have 6 Textbox and 1 ok... With B Team when A Team Play With B Team Again Then Generate Error. I Am Solve... Are There Then It's Large Codding So I Need To Help To Another Way To Do
please help me
please help me  interface Test1 { String toString(); } public class Test { public static void main(String[] args) { System.out.println(new Test1() { public String toString() { return "test
please help me?
please help me?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both
please help me
please help me  how to use two browse buttons, one browse button for displaying the first image and second for the second image along with its file path and also to display text file along with its path using layouts or panels
please help me
please help me  how to use two browse buttons, one browse button for displaying the first image and second for the second image along with its file path and also to display text file along with its path using layouts or panels
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while please please" here is the problem Automatic Teller Machine [B] Balance [D
please help me here
please help me here  please show me how can this show the right output that i need please continue doing this program using only if else and do while please please" here is the problem Automatic Teller Machine [B] Balance [D
please help me solve this problem when i am create database connection using servlecontext
please help me solve this problem when i am create database connection using servlecontext  hi... I have create a database connection using servletcontext . in this code when i login first time it will exceute sucessfully
plz help me for this question
plz help me for this question  Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 â?¤ 200; 3x1 + 5x2 â?¤ 150; 5x1 + 4x2 â?¥ 100; 8x1 + 4x2 â?­â?¥ 80, x1 â?¥ 0, x2 â?¥ 0
Please help me to learn - WebSevices
Please help me to learn  Please help me to learn Java Fast
ajax code please help to solve this........
ajax code please help to solve this.  in this i am trying to get data... null; } please help me when i am running this it show an error...;a href="aboutus.jsp">about us</a></li> <li>
please help me to overcome this problem
please help me to overcome this problem  how to make it easy to write java code. can u please give me suggestions
plz help meto solve this question
plz help meto solve this question  for a file that exist what will be the length() method in the file class return
pls help me with this question
pls help me with this question  how to write a program in C++ using encapsulation,polymorphism,inheritance and abstraction?(all these concepts should come in a single program

Ads