Keyboard Input and switch statement error

Hi,
Below is a program to read an alphabet and check whether its a vowel/consonent using switch statement.
Its always executin' the default stmt and not going into the case 1. This is because the ascii value of the character is being stored rather than the character.Could you please rectify this program?
Thanks,
vs
import java.io.*;
class vowel
public static void main(String args[])throws Exception
System.out.println("Enter a character:");
char ch=(char)System.in.read();
switch(ch)
case 1: if(ch=='a')//||ch=='e'||ch=='i'||ch=='o'||ch=='u')
System.out.println("The character is a vowel-a");
break;
default: System.out.println("The character is a consonent ! ");

     ch = Character.toLowerCase(ch);
     switch (ch) {
          case 'a' :
          case 'e' :
          case 'i' :
          case 'o' :
          case 'u' :
               System.out.println("The character is a vowel: " + ch);
               break;
          default :
               System.out.println("The character is a consonent ! ");
     }

Similar Messages

  • DB13 CheckDb and Update Stats Error

    Hi,
    I am getting below error in CheckDb and Update stats:
    Update Stats:
    BR0301E SQL error -20003 at location stats_tab_collect-20, SQL statement:
    'BEGIN DBMS_STATS.GATHER_TABLE_STATS (OWNNAME => '"SAPCRM"', TABNAME => '"WSSOAPPROP_DARK"', ESTIMATE_PERCENT => NULL, METHOD_OPT => 'FOR ALL COLUMNS SIZE 1', DEGREE => NULL
    ORA-20003: Specified bug number (5099019) does not exist
    ORA-06512: at "SYS.DBMS_STATS", line 14537
    ORA-06512: at "SYS.DBMS_STATS", line 14558
    ORA-06512: at line 1
    Check Db :
    BR0301E SQL error -1031 at location BrDbdiffRead-1, SQL statement:
    'PREPARE stmt_5 STATEMENT FROM'
    'SELECT OBJNAME FROM "SAPSR3".DBDIFF WHERE DBSYS IN ('ORACLE', ' ') AND OBJTYPE = 'TABL' AND DIFFKIND IN ('02', '61', '99') ORDER BY OBJNAME'
    ORA-01031: insufficient privileges
    BR0806I End of BRCONNECT processing: ceeuoqja.chk 2010-12-17 06.30.46
    BR0280I BRCONNECT time stamp: 2010-12-17 06.30.46
    BR0804I BRCONNECT terminated with errors
    Above both errors are of different System and both system are just get ready after System Copy of PRD Server.
    Please suggest possible route cause of this error.
    Shivam

    for update stats issue check Note 1417124 - Error ORA-20001 in statistics class CL_SDB_ORA_UPDATE_STATS
    for DB check error go through note 400241
    Please search before you post your thread on SDN

  • Photohop CS6 Update to 13.0.2 breaks keyboard input and shortcuts

    Hi,
    I just got the new update to 13.0.2 and after installing it Photoshop doesn't recognize keyboard input as expected? Shortcuts are not working anymore. Input values are not recognized. Text editing not possible anymore. etc.
    And: When I start Photoshop I get the following trial info:
    Master Collection trial. 32767 DAYS REMAINING
    Thats over 89 years –  I can live with that. ;-)
    But there is something wrong with that update, that makes it impossible to continue my work.
    Regards
    PS: Is it possible to uninstall this update or do I have to uninstall Photoshop at all?

    Thank you for the quick answer.
    Sytem Info tells me …
    Optional and third party plug-ins:
       Interpolate CS6 (13.0) ©1993-2012 Adobe Systems Incorporated - from the file “Interpolate.plugin”
       Match Edges CS6 (13.0) ©1993-2012 Adobe Systems Incorporated - from the file “Interpolate.plugin”
    Plug-ins that failed to load: NONE
    Flash:
       Mini Bridge
       Kuler
    Installed TWAIN devices: NONE
    In the meantime I did a system restart and several Photoshop restarts. Finally some weirdness is gone. Trial mode seems to be gone and Photoshop seems to be activated again.
    Two thing left:
    1. I do have a text element, for instance, thats acting weird. The screenshot shows two "Login" text items with exactly the same settings for font and size. But they are displayed differently.
    Easy fix: delete the weirdo and create a new one. But still worth mentioning, I think.
    2. One of my favorite shortcuts is gone. cmd+alt+0 (num pad) to set zoom to 100%
    Easy fix: set the shortcut again via Edit > Keyboard shortcuts …
    Sorry for panicking, but I was really worried to lose the day looking at installers. ;-)

  • Multiple rawValues and switch statements - can you do this?

    Hi, a simple question (i hope)
    first i have to use javascript for his one....
    Im just starting a form and it will have about a dozen dropdown lists (over about 15 pages), each with quite a few variables (i feel a headache coming on already...)
    and what i would like to be able to do is have text fields at the end of the form (hidden) and insert data into them depending on what combination of choices the user has made in some or all of the dropdown lists.
    I know how to get a standard switch statement to work fine but can you (and if so what is the syntax like) do this with multiple lists - and what event would be best to link it to - calculate perhaps?
    the switch would be using stored variables and user entered data to produce composite output to the text field (so case: listA.rawvalue = 1 and listB.rawvalue = nine, and listC.rawvalue = cat etc etc [then] this.rawvalue = v1.value + listB.rawvalue etc.....
    I'm sure you get the issue im struggling with  - I've tried it a few ways but my syntax must be off somewhere
    can anyone assist with the syntax for this kind of thing --or a sample would be fantastic.
    cheers

    Hey Legallogic!
    I'm not 100% certain I understand what you are struggling with but I'd be happy to help.  If you could provide an alternate explanation of your issue I'll take a look and help you solve it.  What I *think* you're asking about is in reference to the test case of a switch statement.  Typically a switch would be used to test the value of one particular variable, so:
    switch (varTest)
         case "A":
              //Do something here
              break;
         case "B":
              //Do something else here
              break;
         default:
              //Do something cool here instead
              break;
    Are you asking how to use a single switch to test the value of multiple variables (or fields)?  If so, my recommendation would be to simply use and if/else if/else block as you can craft your test cases however you'd like for those.
    Like I said, I may not have understood the issue here so feel free to shoot me an email and I'll take a peek!
    Josh Boyle
    Cardinal Solutions Group
    [email protected]

  • Korean - keyboard input and reading what I wrote

    I am having serious problems using Korean on my Mac.
    I can switch by going through the finder at the top right to use Korean, but there was another way on the keyboard - unfortunately that way is ow the spotlight menu (the man at the Apple store had used it - but my computer at home doesn't seem to allow this...why?).
    Also - I was about to leave a message on a board in Korean, but after posting it noticed that it only came up as question marks to everyone else - even I couldn't read it once I'd posted it...why? I even sent a test message to my hotmail/yahoo accounts and couldn't reread them in Korean - tried all the text encodings for Korean as well...so just HOW can you communicate in Korean using a Mac?!
    I am new to Mac and living in Korea (Westerner)...there seem to a great many issues with using Mac here...

    Also - I was about to leave a message on a board in
    Korean, but after posting it noticed that it only
    came up as question marks to everyone else - even I
    couldn't read it once I'd posted it...why?
    If you could provide the url of the board it would be easier to help. Some (truly stupid) boards set their encoding to Latin-1. Since this is not right for Korean, all input has to be transformed into numerical html codes. Safari does not do this, but FireFox will. Try that and see if it works.
    You might have the same problem in web mail, though I think using UTF-8 or one of the Korean encodings should work, as long as you remember to set your browser manually to that when you are reading as well as when you are sending.
    You are always a lot better off using a real mail program for non-Latin scripts, since you have no control over what the webmail services do to your encodings.

  • ESS ERP2005: total compensation statement and salary statement errors

    Hello everyone,
    I am facing two problems with ESS on NW04s J2EE SP10 w. Portal and ERP2005 Backend. Both have been discussed here but some time ago and no sufficient answer has been found so I'd like to do a recap:
    1) Salary Statement (and Time Slip also).
    Even if the PAY_SLIP_XY form in hrforms is correct, working within ERP transaction (PY-HF) and customized in IMG HRFOR, the iview producdes the error "<myForm>" not found. When I change <myForm> the change is recognized so obviously the customizing is correct. The same is about Time_Slip forms.
    Anyway, can anyone point me to a link to integrate Adobe DS at this point, should I, or isn't this possible yet?
    2) Total Compensation Satement ivew throws an ArrayIndexOutOfBoundsException -1. The first few stack trace lines are:
    at com.sap.mw.jco.JCO$Record.getString(JCO.java:12778)
        at com.sap.aii.proxy.framework.core.JcoBaseTypeData.getElementValueAsString(JcoBaseTypeData.java:669)
        at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.getAttributeValueAsString(DynamicRFCModelClass.java:427)
        at com.sap.xss.hr.rep.model.rfwmodel.Hrxss_Ser_Rfw_Rfc_Get_Form_Output.getHeight(Hrxss_Ser_Rfw_Rfc_Get_Form_Output.java:179)
        at com.sap.xss.hr.rep.fcrfw.FcRepFramework.callRfcGetForm(FcRepFramework.java:395)
    Restarting the server doesn't help, the server was newly started as the error occured.
    Maybe I missed some IMG activity? I went through the Company Compensation Management and added some values to compensation type, the structure is definied, but not sure if this is all.
    Pls can anyone help. I'm just implementing the standard BP for the moment, no individual app.
    Regards
    Carsten

    Hi Patrick,
    no unfortunately not and as you can see we've got no answers.
    But I'm still in the need to fix it. It's not very urgent, but to know the solution would be great.
    In general we still have problems with print forms in ESS/MSS webdynpro implementation. The HRFORM is defined and well customized in IMG, so I think this is not the point.
    As I pointed out in another post I am confused if Adobe Document Services is needed to render (PDF) print forms since ESS/MSS 600 (for ERP 2005) or what else.
    Do you know?
    Did you get other print forms like salary statement working?
    I went through the entire post installation procedure regarding Adobe DS but it did  not help.
    I always get ther failure "The form  is the form customized for ESS in IMG and the form does exist and is tested within HRFORM transaction.
    Except the time slip (and as well total compensation), where we get this "ArrayIndexOutOfBounds" exception.
    Regards
    Carsten
    Message was edited by:
            Carsten Schön
    Message was edited by:
            Carsten Schön
    correction: error also in total conpensation statement

  • Local class and switch statement -- compiler bug?

    Does anybody know why the following does not compile with "LocalClass cannot be resolved to a type" error in the case 1: block
    public class ProblemClass {
         public void localClassProblem() {
                   class LocalClass {
                        void doNothing() {};          
                   int i = 0; 
                   switch (i) {                    
                        case 1: {
                             LocalClass instance1 = new LocalClass();  //ERROR: unresolved type
                                            break;
    }while the following does (I only added case 2: where LocalClass type is not referenced within an embedded block)
    public class ProblemClass {
         public void localClassProblem() {
                   class LocalClass {
                        void doNothing() {};          
                   int i = 0; 
                   switch (i) {                    
                        case 1: {
                             LocalClass instance1 = new LocalClass();
                                            break;
                        case 2:
                             LocalClass instance2 = new LocalClass();
    }Is it a compiler bug? Thanks for clarifying this.
    --Michal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I'm using 1.5.0-b64
    --Michal                                                                                                                                                                                                                                   

  • A function containing switch statement and foreach-object loop

    Hello Guys
    in my testdomain.lab, i have following five OUs in mt test AD structure:
    'OUusers', 'OUcomputers','OUservers','OUadministrators','OUhelpdesks'.
    i have created following five variables:
    $OUusers = 'ou=OUusers,dc=mytestdomain,dc=lab'
    $OUcomputers = 'ou=OUcomputers,dc=mytestdomain,dc=lab'and so on
    now i have created a function which gets this names as input &
    foreach-object creates the related OU.
    but the problem is sometimes when i run my function, maybe some of those five OUs
    currently exist in AD so this will cause a
    terminating error. 
    so i know i must use switch statement to define conditions like this:
    if $OUusers doesn't exist, execute this :  new-ADOrganizationalunit $OUusers
    if $OUcomputers doesn't exist, execute this :  new-ADOrganizationalunit $OUcomputers
    and so on...
    it's a long time which i am trying to create a
    function which contains such switch statement & properly forEach-object loop.
    i have studied switch and foreach-object loops , but this scenario is complicated for me & i was unable to get the correct code.
    Function createOUs {
    # combination of ForEach-Object and Switch statement here
    may someone give me the correct
    command please?
    thanks a lot

    Like this:
    $CompanyRoot=tha'ou=MyCompany, dc=mytestdomain,dc=lab'
    New-ADOrganizationalUnit -Name MyCompany -ErrorAction SilentlyContinue
    $ous='Users', 'Computers','Servers','Administrators','Helpdesk'
    foreach($ou in $ous){
    New-ADOrganizationalUnit -Name $ou -Path $companyroot -ErrorAction SilentlyContinue
    ¯\_(ツ)_/¯
    jrv, That can't be the solution because when you running a command which tries to creates an OU
    which already exist in AD, causes a
    terminating error which has two caveats:
    1- shows red error message on screen
    2- stops and doesn't continue to execute next lines of code
    Note that -ea silentlycontinue and -ea ignore have no effect on
    terminating errors and they cn't hide error messages, also script can't continue.
    i examined that.
    to get sure, run this function in your test AD & see the result:
    function createOUs {
    New-ADOrganizationalUnit -Name 'an-existing-ou' -Protected 0 -ea SilentlyContinue # you see that -ea silentlycontinue has no effect here
    New-ADOrganizationalUnit -Name '2ndOU' -Protected 0 -ea SilentlyContinue # you see that because the previous error has been a terminating error, command execution has been stopped and this 2nd OU hasn't been creatde
     another bad news is ( as i tested), if we query for an Organizational Unit which doesn't exist in AD , it generates a terminating error as well, so again here -ea has no effect.
    test this:
    PS C:\> Get-ADOrganizationalUnit -identity 'ou=nonesense,dc=yourDomain,dc=lab' -ea ignore
    error doesn't disapear ;-)

  • Enums and keyboard input

    I am currently enrolled in a java class. I am working on a project about enums and switch statements. I get what enums and switch statements are but what I don't get is the input/output. I need the user to be able to pick one of four anwsers.
    This might be something obvious but I am new to this.

    enum Command {SIT, HEEL, ROLL_OVER, BEG};
    public class EnumExample {
        public static void main(String[] args) {
            String[] inputs = {"SIT", "HEEL", "ROLL_OVER", "BEG"};
            for(String input : inputs) {
                Command cmd = Command.valueOf(input);
                System.out.println(cmd);
    }valueOf?

  • On iOS7, Korean Language Input Method with serious error.

    Korean Input Method for iOS7 has serious problems with bluetooth keyboard.
    It has absolutely incorrect state transition for the keyboard typings.
    Keyboard input and cursor moving are independently acting.
    On the word processing apps, when the line changing occurs while typing, error comes on the first word.
    It looks like to have very poor performance while typing.
    clearing last status of input and transiting to a new state to a new word-syllable are not working properly.
    Input method on iOS5 is much stable and better than on iOS7.
    iOS7 Korean Input Method really makes me annoying.

    For Apple to see this, you need to repost it at
    http://www.apple.com/feedback

  • [SOLVED] wmii ignores all keyboard input

    I'm trying to use wmii on my new arch install. No matter which of the wmiircs I use, it never accepts any keyboard input to switch tags, open windows or anything else. The clock is correctly updated and if I open a window using DISPLAY=:1 from another terminal, I can move it around with the mouse. Evilwm is working fine and the only error in Xorg.0.log is related to fbdev. Does anyone have any idea what might be going wrong here?
    EDIT: Just a major PEBKAC. I forgot that Win is the new default modkey and wmii didn't ask me because xmessage wasn't installed.
    Last edited by A.W.A.M (2011-03-12 09:25:52)

    Anyone have any ideas? I tried reinstalling base and base-devel through pacman...still no relief.... This is bizarre.
    EDIT: It's getting worse. System now hangs on boot at "Waiting for UDev uevents to be processed." Things are rapidly going downhill.
    EDIT: No booting due to Udev fixed my booting without acpi. I rebooted into another linux distro to poke around in /var/log/pacman.log for a bit to see if I could find the offending update. Nothing seemed really suspicious, except for the update to "linux-api-headers." (Anything with "headers" is suspicious. So, I decided I would boot back into Arch and try to downgrade that package. After booting back into Arch, I see that the problem has disappeared...so...I dunno what to say...I have no idea what/how this got fixed, or how I (yes, let's be honest here...it must be "I") broke it in the first place.
    Last edited by lasu1 (2010-03-28 00:44:43)

  • Keyboard Input Output Problems on Mac OS X

    Hey guys,
    I'm at college studying Java, however my teacher and the rest of the class all use the Kawa IDE, I've been using Project Builder, provided with Mac OS X. Our tutor gave us a class made up of various methods which the college designed to handle keyboard Input and Output, however when I import it I get unpredictable results. I've put it online at: http://www.lostroom.co.uk/inout/
    All I'm trying to do is run a simple program;
    import InOut;
    class CostReckoner
    public static void main(String[] args)
    // Declare the variables
    int quantity;
    double unitCost, basicCost, vatCost, totalCost;
    double vatRate = 0.175;
    // Input the number of items and the cost per item
    System.out.print("What is the unit cost of the items?");
    unitCost = InOut.readDouble();
    System.out.print("How many items in the order?");
    quantity = InOut.readInt();
    // Calculate the cost of the order
    basicCost = unitCost * quantity;
    vatCost = basicCost * vatRate;
    totalCost = basicCost + vatCost;
    //Output the total cost of the order
    System.out.println("Cost �"+InOut.format(basicCost,2));
    System.out.println("Vat �"+InOut.format(vatCost,2));
    System.out.println("Total �"+InOut.format(totalCost,2));
    I seem to need to press space bar after I input anything, as it doesn't recognise "Return" without it. Any ideas ??
    Strange thing is it seems to work fine on the PC Kawa IDE within college. Any advice you guys could offer would be really appreciated. Send me an email at: <[email protected]> if you can help.
    Regards, Gareth

    Hi thanks for your help, I tried compiling the code you gave me to read the streams, however I seem to be have problems with it.
    ERROR
    keys.java:18: unreported exception java.io.IOException; must be caught or declared to be thrown
    n=stream.read();
    HERE IS THE CODE I'M TRYING TO COMPILE
    import java.io.*;
    public class keys {
    public static void main(String[]arguments)
    BufferedInputStream stream = new BufferedInputStream(System.in);
    int n=0;
    while(true){
    n=stream.read();
    System.out.println(Integer.toHexString(n));
    if (n==0x30) break;// this termination condition is optional
    Any ideas ??

  • Consume keyboard input

    I am looking for a way to put my gui application in a "wait state." What this entails is that the mouse cursor shows an hourglass and mouse clicks are ignored. Also, any keyboard activity is ignored as well. The reason for this functionality is that there are times that my program needs to perform cpu intensive work and I would like the user to wait until the work is complete before the gui becomes responsive again.
    Now, I figured out how to ignore the input from the mouse by using adding a mouse listener to the GlassPane of the gui's JFrame and setting the GlassPane visible. But I can't find a way to use the GlassPane as a "buffer" between the user's keyboard input and the gui. The only alternative that I have found is to add a KeyListener to every component that can receive keyboard input but I would rather not have to manually add a new listener to every single button, textfield, and table that I might have added to the frame. Is there an elegant solution to ignoring or consuming all keyboard activity on a frame that is already set visible? Thanks for your responses.

    You know, if I read the entire message of the OP, I wouldn't look quite so dumb!
    Take a look at the following. It will block and unblock keyboard input.
    public class DispatchTest
        KeyEventDispatcher blocker = null;
        public JPanel buildPanel()
            JPanel p = new JPanel(new FlowLayout());
            p.add(new JTextField(20));
            return p;
        public void blockInput()
            if (blocker == null)
                blocker = new KeyEventDispatcher()
                    public boolean dispatchKeyEvent(KeyEvent e)
                       e.consume();
                        return true;
            KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(blocker);
        public void unblockInput()
            if (blocker != null)
                KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(blocker);
        public static void main(String[] x)
            JFrame f = new JFrame();
            DispatchTest t = new DispatchTest();
            f.setContentPane(t.buildPanel());
            t.blockInput();
            f.pack();
            f.setVisible(true);
    }Message was edited by:
    ipooley

  • Solaris 10 8/07 Install hangs awaiting keyboard input

    I have a W2100z Java Workstation that I am trying to install S10 8/07 on. When it first powers up, I get the standard bios prompts and can hit F2/F8 to customize things as I wish.
    However, when I start the Solaris install from CD, after the OS installer is loaded, it first prompts for 1, 2, 3, 4, ... choices (1 being an interactive install). No amount of keyboard punching seemed to get it to make a choice. So after about 30 seconds or so, it times out and presumes interactive install.
    After a bit, it loads a text-based window to let me choose a language. Just move the cursor around, select a language, and then hit F2 to continue. Unfortunately, it does not recognize any keyboard input and just sits there comatose for as long as I choose to wait.
    So, perhaps I have a keyboard issue, so I swapped out a Kensington for a Dell keyboard. That didn't work so I acquired a Sun keyboard. That doesn't work either. I've also plugged the keyboard into every USB slot I could find (two on the front and 3 on the back), all to no avail.
    Now, Solaris 11 from the SXDE has no problem booting and installing on this computer with all of those keyboards. Unfortunately, that is academic in that I need to run S10.
    So what is the magic to getting the W2100z to boot/install Solaris 10?

    After much gnashing of teeth and pulling of hair, I found an BIOS upgrade for the W2100z. The keyboard now is recognized and the bits are installing.

  • Continue in a switch statement

    What is the difference between using unlabelled continue and break in a switch statement?
    Looks like there is the same effect but I didn't found anything about using continue in switch in any documentation.
    Here's a typical explanation of using switch statement:
    "If the condition in a +switch statement+ matches a case constant, execution will run through all code in the +switch+ following the matching case statement until a +break statement+ or the end of the +switch statement+ is
    encountered. In other words, the matching case is just the entry point into the case block, but *unless there's a break statement*, the matching case is not the only case code that runs"
    Is it a good practise to use continue instead of break in such case?

    Books are right again :))
    Thanks everybody who wrote here.
    As I found out continue is only for use in the loop statements. I just use continue inside both for and switch statements and that's why I thought that it's appropriate to use it inside switch. No way!! In this way continue will affect only loop, not switch statement.
    For example:
    class BreakTest {
         public static void main(String[] args) {
              BreakTest br = new BreakTest();
              br.testContinue();
              br.testBreak();
         public void testContinue() {
              int[] int_arr = { 0, 0, 0, 0, 1, 0, 0 };
              int count_in_switch = 0;
              int count_in_for = 0;
              for (int a : int_arr) {
                   switch (a) {
                   case 0:
                        continue;
                   default:
                        count_in_switch++;
                   count_in_for++;
              System.out.println("count_in_switch=" + count_in_switch
                        + " count_in_for=" + count_in_for);
         public void testBreak() {
              int[] int_arr = { 0, 0, 0, 0, 1, 0, 0 };
              int count_in_switch = 0, count_in_for = 0;
              for (int a : int_arr) {
                   switch (a) {
                   case 0:
                        break;
                   default:
                        count_in_switch++;
                   count_in_for++;
              System.out.println("count_in_switch=" + count_in_switch
                        + " count_in_for=" + count_in_for);
    count_in_switch=1 count_in_for=*1*
    count_in_switch=1 count_in_for=*7*
    In case of using continue you won't get to count_in_for++; - you'll jump to the next iteration of for loop.
    In case of using break you'll go out of switch and go to next statement, that goes after switch block

Maybe you are looking for