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 character is vowel or not.

View Answers

October 30, 2010 at 10:56 AM

Hello Friend,

Try the following code:

import java.util.*;
class Vowel 
{
    public static void main(String[] args) 
    {
        char charr[]={'a','e','i','o','u'};
        Scanner input=new Scanner(System.in);
        System.out.println("Enter a character: ");
        char ch=input.next().toLowerCase().charAt(0);
        if((charr[0]==ch)||(charr[1]==ch)||(charr[2]==ch)||(charr[3]==ch)||(charr[4]==ch)){
                System.out.println("Entered character is vowel");
            }
            else{
                System.out.println("Entered character is not a vowel");

            }
    }
}

Thanks


October 30, 2010 at 12:56 PM

tq so much 4 helping me...i really appreciate it... :)... i've another question..n try to do it...

an internet service provider has three different subscription packages for its customers:

package A : for RM9.99 per month 10 hours for access are provided. additional hours are RM2.99 per hour.

package B : for RM19.99 per month 20 hours of access are provided. additional hours are RM1.99 per hour.

package C : for RM29.99 per month unlimited access is provided.

write a program that calculates a customer's monthly bill. it should store the letter of the package that customer has purchased (A,B or C) and the number of hours that were used. the program should display the total charges.

here my coding so far...

import java.util.*; public class MonthlyBill { public static void main (String[]args) { double payrate=0; int hours;

 Scanner scan=new Scanner(System.in);
  System.out.println("Enter customer's name: ");
  String name=scan.nextLine();

  System.out.println("Enter package('A' or 'B' or 'C') : ");
  String pack=scan.nextLine();



  if(pack.equalsIgnoreCase("A"))
  {
     payrate=9.99;
      System.out.println("Enter your customer's hour here:");
      int hour=scan.nextInt();

      if(hours >= 10)
      payrate= payrate * 2.99;


  }
  else if(pack.equalsIgnoreCase("B"))
  {
     payrate=19.99;
      System.out.println("Enter your customer's hour here:");
      int hour=scan.nextInt();

      if(hours >= 20)
      payrate= payrate * 1.99; 

  }
  else if(pack.equalsIgnoreCase("C"))
  {
     payrate=29.99;
      System.out.println ("No extra charge for your additional hours");
      System.out.println ("You get unlimited access");
  }

      System.out.println ("Total monthly bill \n" + payrate);     

 }

}

i think there is so many error...please try check it out..









Related Tutorials/Questions & Answers:
hello
Java Error in Hello World  Java Error in Hello World
hello
Java Hello World  HELLO World program in Java
Advertisements
Hello
Hello  Hello sir i want to store upload doc file in ms access by using servlet. Can i store file in access.one another things access only text size is 255 character but my file is up to 2mb how i can store
Hello ..
Hello ..  Hello, I need a code for .. Want to read csv file (which is having name nd mobile number) from jsp and if i give search by name mobile number should get displayed and if i give mobile number name should get
hello
character is vowel or not.   Hello Friend, Try the following code
hello
...please try check it out..ADS_TO_REPLACE_5   Hello Friend, We have
Hello Eyeryone...
Hello Eyeryone...  how to download java material in roseindia.net website material please kindly help me... by visu
hello
hello
hello
hello
hello
Hello world
Hello world (First java program)   ... and can be run on any operating System. Writing Hello World program is very simple. To write the Hello world program you need  simple text editor like note
ModuleNotFoundError: No module named 'hello'
ModuleNotFoundError: No module named 'hello'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'hello' How to remove the ModuleNotFoundError: No module named 'hello'
print hello n hi
print hello n hi  how to write a java program that prints "hello" 5 times, "hi" 1 time n again "hello" 4 times..?? do reply
Hello world program
Hello world program  hello world program   class Hello{ public static void main(String[] args) { System.out.println("Hello World"); } } For more information, visit the following link: http
Hello World in servlet
Hello World in servlet  Hello World example in servlet ?   import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public..., IOException { PrintWriter out = res.getWriter(); out.println("Hello
hello in vertical manner
hello in vertical manner  How to print HELLO as in vertical manner   Hi, Try this: class HelloExample { public static void main(String[] args) { String str="HELLO"; char ch[]=str.toCharArray
Hello World - Java Beginners
Hello World  Java Beginner - 1st day. Looked at the Hello World script and thought I would give it a try....I created the script in Notepad. Saved...){ System.out.println("Hello World!"); } } what am I doing wrong. Am I expecting
Version of com.lijinchao>hello dependency
List of Version of com.lijinchao>hello dependency
Getting exception in hello world
Getting exception in hello world  I run your hibernate5 "hello world" program. But, getting an exception: ERROR: Table 'mydb.employee' doesn't exist Exception in thread "main" javax.persistence.PersistenceException
Getting exception in hello world
Getting exception in hello world  I run your hibernate5 "hello world" program. But, getting an exception: ERROR: Table 'mydb.employee' doesn't exist Exception in thread "main" javax.persistence.PersistenceException
Hello - Java Beginners
Hello  Hello I have a two button update and delete I want to user click on update button then msg will be displayed in msg box Are u sure want to update If user click yes then all record will be updated
J2ME Hello World Example
J2ME Hello World Example       This is the simple hello world application. In this example we are creating a form name "Hello World" and creating a string message "
Hello World Program
Hello World Program  write a java program that continuously prints HelloWorld! to the screen(once every second ) and exists when press the enter key... = new DisplayMessageContinuously("Hello World ", 1000); th.start
EJB Hello world example
EJB Hello world example       Creating and testing the "Hello World" Example is the very first... example we are going to show you, how to create your first hello world example
hello there i need help
hello there i need help  : i need to do a program like this: Automatic Teller Machine [B] Balance [D] Deposit [W] Withdrawal [Q] Quit select you OPtions: once i have chosen an option then i should proceed here if i choose b
pring Hello World Application
Spring Hello World Application       Hello World Example using Spring, The tutorial given below describes you the way to make a spring web application that displays Hello World
ModuleNotFoundError: No module named 'andy_hello'
ModuleNotFoundError: No module named 'andy_hello'  Hi, My Python... 'andy_hello' How to remove the ModuleNotFoundError: No module named 'andy_hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'andy_hello'
ModuleNotFoundError: No module named 'andy_hello'  Hi, My Python... 'andy_hello' How to remove the ModuleNotFoundError: No module named 'andy_hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'mv_hello'
ModuleNotFoundError: No module named 'mv_hello'  Hi, My Python..._hello' How to remove the ModuleNotFoundError: No module named 'mv_hello... to install padas library. You can install mv_hello python with following
ModuleNotFoundError: No module named 'pip-hello'
ModuleNotFoundError: No module named 'pip-hello'  Hi, My Python... 'pip-hello' How to remove the ModuleNotFoundError: No module named 'pip-hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'plup-hello'
ModuleNotFoundError: No module named 'plup-hello'  Hi, My Python... 'plup-hello' How to remove the ModuleNotFoundError: No module named 'plup-hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'plup-hello'
ModuleNotFoundError: No module named 'plup-hello'  Hi, My Python... 'plup-hello' How to remove the ModuleNotFoundError: No module named 'plup-hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'print_hello'
ModuleNotFoundError: No module named 'print_hello'  Hi, My Python... 'print_hello' How to remove the ModuleNotFoundError: No module named 'print_hello' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'py-hello'
ModuleNotFoundError: No module named 'py-hello'  Hi, My Python...-hello' How to remove the ModuleNotFoundError: No module named 'py-hello... to install padas library. You can install py-hello python with following
ModuleNotFoundError: No module named 'reliveyy-hello'
ModuleNotFoundError: No module named 'reliveyy-hello'  Hi, My... named 'reliveyy-hello' How to remove the ModuleNotFoundError: No module named 'reliveyy-hello' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'say_hello'
ModuleNotFoundError: No module named 'say_hello'  Hi, My Python... 'say_hello' How to remove the ModuleNotFoundError: No module named 'say_hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'sfy_hello'
ModuleNotFoundError: No module named 'sfy_hello'  Hi, My Python... 'sfy_hello' How to remove the ModuleNotFoundError: No module named 'sfy_hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'sodaplum_hello'
ModuleNotFoundError: No module named 'sodaplum_hello'  Hi, My... named 'sodaplum_hello' How to remove the ModuleNotFoundError: No module named 'sodaplum_hello' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'solima-hello'
ModuleNotFoundError: No module named 'solima-hello'  Hi, My Python... 'solima-hello' How to remove the ModuleNotFoundError: No module named 'solima-hello' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'test-hello'
ModuleNotFoundError: No module named 'test-hello'  Hi, My Python... 'test-hello' How to remove the ModuleNotFoundError: No module named 'test-hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'vj_hello'
ModuleNotFoundError: No module named 'vj_hello'  Hi, My Python..._hello' How to remove the ModuleNotFoundError: No module named 'vj_hello... to install padas library. You can install vj_hello python with following
ModuleNotFoundError: No module named 'wedoca-hello'
ModuleNotFoundError: No module named 'wedoca-hello'  Hi, My Python... 'wedoca-hello' How to remove the ModuleNotFoundError: No module named 'wedoca-hello' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'xai-hello'
ModuleNotFoundError: No module named 'xai-hello'  Hi, My Python... 'xai-hello' How to remove the ModuleNotFoundError: No module named 'xai-hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'zhang-hello'
ModuleNotFoundError: No module named 'zhang-hello'  Hi, My Python... 'zhang-hello' How to remove the ModuleNotFoundError: No module named 'zhang-hello' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'andy_hello'
ModuleNotFoundError: No module named 'andy_hello'  Hi, My Python... 'andy_hello' How to remove the ModuleNotFoundError: No module named 'andy_hello' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'dogebuild-hello'
ModuleNotFoundError: No module named 'dogebuild-hello'  Hi, My... named 'dogebuild-hello' How to remove the ModuleNotFoundError: No module named 'dogebuild-hello' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'funny-hello'
ModuleNotFoundError: No module named 'funny-hello'  Hi, My Python... 'funny-hello' How to remove the ModuleNotFoundError: No module named 'funny-hello' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'hello-amit'
ModuleNotFoundError: No module named 'hello-amit'  Hi, My Python... 'hello-amit' How to remove the ModuleNotFoundError: No module named 'hello-amit' error? Thanks   Hi, In your python environment you

Ads