Case Switch in subclass not working?

I wrote a class and a subclass to convert an integer in feet and inches to centimeters and vice versa. I used a case switch in the subclass but when I run the program and type 1 for example it just goes to the next statement in the mian class and not whats in the switch. Sorry if this seems confusing. Here are the porgrams. First is the subclass.
  import java.util.*;
    public class Measure
      static Scanner console=new Scanner(System.in);
      public int feet;
      public int inch;
      public double cent;
      public int measure;
       public Measure()
         switch(measure)
            case 1:
               System.out.println("Enter feet for conversion, if feet equals zero, type 0");
               feet=console.nextInt();
               if(feet<0)
                  System.out.println("ERROR");
                  System.out.println("Invalid Entry");
                  System.out.println("Please enter a positive number");
               System.out.println("Enter inches for conversion, if inches equals zero, type 0");
               inch=console.nextInt();
               if(inch<0)
                  System.out.println("ERROR");
                  System.out.println("Invalid Entry");
                  System.out.println("Please enter a positive number");
               break;
            case 2:
               System.out.println("Enter centimeters for conversion");
               if(cent<0)
                  System.out.println("ERROR");
                  System.out.println("Invalid Entry");
                  System.out.println("Please enter a positive number");
               break;
            case 3:
               System.out.println("GOODBYE");
               break;
       public int getFeet()
         feet=12*inch;
         return feet;
       public int getInch()
         return inch;
       public double getCent()
         cent=inch*2.54;
         return cent;
       public void printMeasure()
   }Here is the main class
import java.util.*;
    public class MeasurementMain extends Measure
      static Scanner console=new Scanner(System.in);
       public static void main(String[]args)
         int feet=0;
         int inch=0;
         double cent=0;
         int measure=0;
         System.out.println("***********************************");
         System.out.println("****                           ****");
         System.out.println("****  Measurement Conversion   ****");
         System.out.println("****                           ****");
         System.out.println("***********************************");
         while(measure!=3)
            System.out.println("Type 1 to enter a measurement in Feet and Inches, or 2 for centimeters");
            System.out.println("Type 3 to EXIT");
            measure=console.nextInt();
            if(measure==1)
               System.out.println(""+feet+" feet and "+inch+" is equal to "+cent+"");
            if(measure==2)
               System.out.println(""+cent+" centimeters are equal to "+feet+" feet and "+inch+" inches");
   }Thanks in advance.

I moved my case switch to the main program but i can't get the conversion methods to work or print.
Thanks in advance.The subclass is listed first.
  import java.util.*;
    public class Measure
      static Scanner console=new Scanner(System.in);
      public static final double CM_PER_INCH = 2.54;
      public static final double INCHES_PER_FOOT = 12;
      public double feet;
      public double inch;
      public double cent;
      public int measure;
       public Measure()
         System.out.println("***********************************");
         System.out.println("****                           ****");
         System.out.println("****  Measurement Conversion   ****");
         System.out.println("****                           ****");
         System.out.println("***********************************");  
       public void printMeasure()
       public double inchesToCentimeters(double inch)
         return cent=inch*2.54;
       public double feetToInches(double feet)
         return feet=inch*12;
       public double centimetersToInches(double cent)
         return cent=inch/2.54;
       public double inchesToFeet(double inch)
         return      feet = inch * 12;
   }Here is the main
    import java.util.*;
    public class MeasurementMain
      static Scanner console=new Scanner(System.in);
       public static void main(String[]args)
        int measure=0;
        int feet=0,inch=0;
        double cent=0;
         Measure m=new Measure();
         while(measure!=3)
            System.out.println("Type 1 to enter a measurement in Feet and Inches, or 2 for centimeters");
            m.printMeasure();
            System.out.println("Type 3 to EXIT");
            measure=console.nextInt();
            switch(measure)
               case 1:
                  System.out.println("Enter feet for conversion, if feet equals zero, type 0");
                  feet=console.nextInt();
                  m.feetToInches(feet);
                  m.inchesToCentimeters(inch);
                  if(feet<0)
                     System.out.println("ERROR");
                     System.out.println("Invalid Entry");
                     System.out.println("Please enter a positive number");
                  System.out.println("Enter inches for conversion, if inches equals zero, type 0");
                  inch=console.nextInt();
                  m.inchesToCentimeters(inch);
                  m.printMeasure();
                  if(inch<0)
                     System.out.println("ERROR");
                     System.out.println("Invalid Entry");
                     System.out.println("Please enter a positive number");
                  break;
               case 2:
                  System.out.println("Enter centimeters for conversion");
                  cent=console.nextInt();
                  m.centimetersToInches(cent);
                    m.inchesToFeet(inch);
                  if(cent<0)
                     System.out.println("ERROR");
                     System.out.println("Invalid Entry");
                     System.out.println("Please enter a positive number");
                  break;
               case 3:
                  System.out.println("GOODBYE");
                  break;   
            if(measure==1)
               System.out.println(""+feet+" feet and "+inch+" inches is equal to "+cent+" centimeters");
            if(measure==2)
               System.out.println(""+cent+" centimeters are equal to "+feet+" feet and "+inch+" inches");
   }

Similar Messages

  • Switch Theme is not working in apex 4.2.Plz  help me out.........

    Hi.......
    Switching from one theme to another theme is not working in apex 4.2..............
    Thanx in advance

    Hi!
    Same problem.
    Upgraded from 4.1 -> 4.2.
    Change theme from slightly modified Green theme (in mine case 101 is number and original was 11, One level Tabs) to Theme 25 Blue Responsive.
    Login page for instance doesn have "Login Region" for instance (not in LOV). And all pages are softly said strange.
    All have DISPLAY problem described on "http://1.bp.blogspot.com/-GzseTk6Lpes/UHvJkg9GulI/AAAAAAAAHRQ/Wt406GGZADQ/s640/Screen+Shot+2012-10-15+at+10.25.29.png", but without many parts that Dmitri describe.
    Rg
    Damir

  • Exchange 2013 CAS - Round Robin DNS not working properly

    I have exchange 2013 server (2MB, 2CAS) server. I created two dns records for mail.test.com, autodiscover.test.com pointing to my two CAS servers.
    But the problem is if i switched of one cas server, client outlook not connecting automatically to other CAS server. By restarting the outlook also its not working. By restarting the system or running the command ipconfig /flushdns in command prompt, it
    working.
    is there any configuration iam missing, please advice how to achieve decent load balancing in Exchange 2013 CAS without going for third party Loadbalancer...

    I have exchange 2013 server (2MB, 2CAS) server. I created two dns records for mail.test.com, autodiscover.test.com pointing to my two CAS servers.
    But the problem is if i switched of one cas server, client outlook not connecting automatically to other CAS server. By restarting the outlook also its not working. By restarting the system or running the command ipconfig /flushdns in command prompt, it
    working.
    is there any configuration iam missing, please advice how to achieve decent load balancing in Exchange 2013 CAS without going for third party Loadbalancer...
    If a CAS role server is down or unable to service clients, you have to remove it from  DNS round-robin consideration manually. There is no health check with DNS round-robin unlike a true load balancer.
    Also, I would set the TTL to a low value for the CAS servers in the round-robin.
    Twitter!: Please Note: My Posts are provided “AS IS” without warranty of any kind, either expressed or implied.

  • Toshiba Portégé R830 wireless On/Off switch (Fn+F8) not working

    Hello...
    I have posted this on the Wi-Fi troubleshooting forum, but it's not getting any bites.
    Just in case anyone has found a solution, here is the link to the original post:
    http://forums.toshiba.com/t5/Port%C3%A9g%C3%A9-Laptops/Booting-with-Wi-Fi-off/td-p/206448
    I work for a large coporation and have purchased hundreds of Toshiba Portégé R830s and Toshiba Tecra R850s and we have installed our corporate image on them (Windows XP) and cannot seem to get be able to turn the wireless card on and off using the the Fn+F8 Key Combination. The light is  I've attached an image of all the utilities and what order we are installing them in, after installing these utilities it is still not working. Are there additional utilities we should be installing? The model we have has the Intel Wi-Fi chip (not the Atheros one) in it and we are using the latest Intel Wireless LAN Driver from the Toshiba site (14.0.2.2.1.x32_wCAT)  . The Wi-Fi light just stays on all the time and we can connect to a wifi hotspot. But, we would like to be able to turn the wireless on and off with the Fn+F8 Key Combination. If anyone can provide any help with this, it would be greatly appreciated.
    Thanks 
    Attachments:
    hotkey.jpg ‏37 KB

    just to agree you are not alone with that problem
    lots of users including me are complaining in the web!
    and it's not only your devices where it is not working.
    myself never got a sufficient answer either
    http://forums.toshiba.com/t5/Port%C3%A9g%C3%A9-Laptops/R700-Fn-F8-WLan-on-off-nuisance/m-p/185552#M1...
    disregard all suggestions to reinstall all software in the 'right order'
    whatever that is anyway. its a waste of time.
    so I disable it via device manager (despite that the light will stay on!)
    shortcut: devmgmt.msc
    Toshiba decided to swab from a hardware button to a buggy software switch.
    because its ON by default the majority of users do not care/complain.
    for that reason Toshiba does not bother to sort that problem properly out
    too. they had plenty of time for it already...
    regards
    Damian

  • Windows 8.1 with Hyper-V external switch - 802.1x not working in host nor guest

    Hi,
    I have Windows 8.1 with installed Hyper-V and virtual machines connected via Hyper-V Switch - External. 802.1x wired authentication is not working in host nor in guest machine (computer is not responding to switch requests). If I will change switch mode
    to Internal/Private it will start working.
    Do you have any idea how to get it working also in external mode?

    Hi,
    What is the physical network configuration in your environment? Are you using wireless or wired connection?
    We tested this issue as you described here, and the external switch is working fine.
    Have you tried to delete the created switches and recreate one, test this issue again?
    Yolanda Zhu
    TechNet Community Support

  • Dock not working; command-tab switch between programs not working

    The Dock does not work. I have restarted (although the computer will not restart under "Restart", getting stuck at the last part, and needs to be restarted manually). When I change Dock preferences it reverts back to default settings. If I am lucky, the dock will appear and then disappear (poof) without having functioned.
    The command tab function for switching between programs stopped working also.
    The individual programs work, but I have to go to recent items to switch programs.
    Further, I have two Previews open (with different documents in each) even though I have only one Preview program.
    A whole lot of bizarre things that may be connected? I would appreciate any help.

    You could try removing the .plist file again, but this time, try also removing the com.apple.dock.db file. Then log out and log in again.
    Also, it seems as if many people are having similar problems. See [this thread|http://discussions.apple.com/thread.jspa?messageID=9126119].
    So, does the problem persist with another user account?
    If it were my machine, the next thing I'd try is downloading the combo updater from Apple's website and reinstalling it. 10.5.6 is available [here|http://support.apple.com/downloads/MacOS_X_10-5-6_ComboUpdate].

  • Zero Fill and Upper Case in Visual Composer not working

    Hello,
    I am building my first VC application and hit a small wall from get go. When I create input fields and set text formats for one to have "Zero Fill" and for the other one "Upper Case" they do not seem to work properly.
    “Zero Fill” does not work at all. I set this format and also set max length as 10 to be used as input for customer account #. But it does not perform conversion. When I call a BAPI to get customer list, if I enter 0000000100 it works. When I enter 100 it does not work. Thus "Zero Fill" does not take effect.
    "Upper case" works but only after refresh. If I enter ac10 as company code and then click submit it does not work. However if after entering ac10 I press enter and then submit, it work.
    Does anyone have any info on how to deal with this? We are using VC 7.0
    Thanks,
    Alex

    Hi ALex,
    Now I got your problem. I suggest a solution for it.
    Go to the design board of VC.
    I think you have an Input Form that contains the input fields and the Submit button. There will be a link named "submit"between the Input Form & the Data Service(say BAPI). Click on the  submit link, you will get the Input Fields & Assigned values of the Input Form at the bottom right side. Go to the Assigned Value of the particular field & apply a formula like UPPER(@inputfield). So now whatever case you give in the inputfield, it is converted to UPPER case before Submiting the values.Keep the Upper Case option checked at the formatting tab of the Input field properties, this will help to display the value in Upper case.
    For eg, BAPI_BANK_GETLIST, the input fields are BANK_CTRY & MAX_ROWS.
    Make the assigned value of bank_ctry as UPPER(@BANK_CTRY), you can get this with the help of formula. 
    This will solve your problem.
    Regards,
    Shemim

  • Please help me my iphone 4 switch off and not working

    please help me my iphone switch off and not working

    Hello safaabh,
    I would be concerned too if my iPhone would not power on.  I found an article with steps you can take when you encounter an issue like this.  I recommend following the steps below:
    Will not turn on, will not turn on unless connected to power, or unexpected power off
    Verify that the Sleep/Wake button functions. If it does not function, inspect it for signs of damage. If the button is damaged or is not functioning when pressed, seek service.
    Check if a Liquid Contact Indicator (LCI) is activated or there are signs of corrosion. Learn about LCIsand corrosion.
    Connect the iPhone to the iPhone's USB power adapter and let it charge for at least ten minutes.
    After at least 15 minutes, if:
    The home screen appears: The iPhone should be working. Update to the latest version of iOS if necessary. Continue charging it until it is completely charged and you see this battery icon in the upper-right corner of the screen . Then unplug the phone from power. If it immediately turns off, seek service.
    The low-battery image appears, even after the phone has charged for at least 20 minutes: See "iPhone displays the low-battery image and is unresponsive" symptom in this article.
    Something other than the Home screen or Low Battery image appears, continue with this article for further troubleshooting steps.
    If the iPhone did not turn on, reset it while connected to the iPhone USB power adapter.
    If the display turns on, go to step 4.
    If the display remains black, go to next step.
    Connect the iPhone to a computer and open iTunes. If iTunes recognizes the iPhone and indicates that it is in recovery mode, attempt to restore the iPhone. If the iPhone doesn't appear in iTunes or if you have difficulties in restoring the iPhone, see this article for further assistance.
    If restoring the iPhone resolved the issue, go to step 4. If restoring the iPhone did not solve the issue, seek service.
    You can find the full article here:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/TS2802
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • CASE in Stored Procedure Not Working

    Why is this not working?
    SET NOCOUNT ON;
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
    SELECT
    dbo.Components.*,
    CASE ISNULL(dbo.Components.MarkupPrice,0)
    WHEN 0 THEN dbo.Components.Quantity * dbo.Components.UnitCost.
    ELSE dbo.Components.Quantity * dbo.Components.MarkupPrice END AS ExtCost,
    FROM ...
    Error Message
    Msg 156, Level 15, State 1, Procedure procGetReportSpecBook, Line 64
    Incorrect syntax near the keyword 'ELSE'.
    Thanks!

    Please try below instead of THE case when in Your code:
    Case when ISNULL(dbo.components.markupprice,0)= 0
    THEN dbo.components.quantity*dbo.components.unitcost
    Else dbo.components.quantity*dbo.components.markupprice
    End as ExtCost
    OR
    Case when COALESCE(dbo.components.markupprice,0)= 0
    THEN dbo.components.quantity*dbo.components.unitcost
    Else dbo.components.quantity*dbo.components.markupprice
    End as ExtCost
    OR
    Case when dbo.components.markupprice IS NULL
    THEN dbo.components.quantity*dbo.components.unitcost
    Else dbo.components.quantity*dbo.components.markupprice
    End as ExtCost
    Regards, Reshma
    Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered

  • Screen switch for presentations not working

    Embarrassing when you're all hooked up and no-where to go!
    Sat down in a meeting to present and the screen switch did not work! Fortunately it came on automatically when I opened PPT.
    Good heavens! HP. You can do better than that. FFS

    Update, I also have tried the goSerial application as well, and that does the same thing.  I have tried the same usb to serial cable on my ubuntu laptop and that is working fine, so I know it's not the cable.
    Thanks!

  • Case 0184236753  PHOTO SHOP NOT WORKING

    I have got emails tell me that my case was closed. NO IT IS NOT as my PHOTO SHOP IS NOT WORKING.  the only time they call is when im at work and they never call me when i tell them im at home!!!!!!!!!! [email removed by admin]   they never call to fix anything when i home.    They messed up my computer and now have not call to fix it.......case 0184236753

    You realize, this is a User to User forum and you are not talking to "Adobe" here, right?
    Unless you want to outline your issues, there's exactly zero we can do to help you...

  • Case with Keyboard Will Not Work on my HP 7"1800 Android Tablet

    I baught a HP 7" 1800 android  tablet and I resently baught a case with a keyboard and I can not get it to work. I have tryed every thing that I know to get it to work but it will not work! I would like to know how to get this keyboard in my case to work? Has anyone got any sugestions? 

    Is the keyboard using a cable or BlueTooth?  If a cable, it will not work. If using BlueTooth, I would re-read the instructions provided with the keyboard. 1. Be sure the keyboard is compatible with Android.  This should be stated in the instructions somewhere. 2. Put the keyboard into "pairing mode" per the instructions.  This usually requires specific button presses. 3. Be sure BlueTooth is turned on in your tablet, and you have told it to "Scan for new devices" while the keyboard is in pairing mode. I have successfully used an old Palm Inc. BlueTooth keyboard with many HP tablets. WyreNut

  • Ping to Switch in DMZ not working from Edge Switch

    Hi Everyone,
    Below is my home Lab setup
    Sw1----trunk ----ospf  sw2-------direct conenction to ASA------DMZ  ------SW3 -------
    Switch3 has SVI IP 192.168.69.1
    I can ping the IP 169.168.69.1 from sw2 as this has default static route to ASA outside interface IP address.
    But i can not ping IP 192.168.69.1 from SW1 need to why ?
    is this default behaviour?
    On switch 1 i add the static route 192.168.69.0 255.255.255.0 192.168.11.1
    Where 192.168.11.1  is interface IP of Sw2 which has direct connection to ASA outside Interface IP ---192.168.11.2.
    Also i define Loopback IP 192.167.77.1  on Sw3.
    This IP i can ping from Sw1  but IP 192.168.69.1 i can not ping.
    I define below static route of Sw1
    ip route 192.168.77.0 255.255.255.0 192.168.10.2
    where 10.2 is vlan 10 IP  on Sw2.
    Thanks
    Mahesh
    Message was edited by: mahesh parmar

    Hi jouni,
    yesterday i already tried with gateway IP of 192.168.10.2  it did  not work then i used 11.1 as gateway same issue.
    Today i tried again same thing.
    3550SMIA(config)#ip route 192.168.69.0 255.255.255.0 192.168.10.2
    3550SMIA(config)#end
    3550SMIA#ping 192.168.69.1
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 192.168.69.1, timeout is 2 seconds:
    Success rate is 0 percent (0/5)
    3550SMIA#
    here is sh ip route
    3550SMIA# sh ip route
    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
           E1 - OSPF external type 1, E2 - OSPF external type 2
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
           ia - IS-IS inter area, * - candidate default, U - per-user static route
           o - ODR, P - periodic downloaded static route
    Gateway of last resort is 192.168.5.3 to network 0.0.0.0
         100.0.0.0/32 is subnetted, 1 subnets
    O       100.100.100.100 [110/3] via 192.168.5.3, 5d02h, FastEthernet0/11
         3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    O       3.3.3.3/32 [110/2] via 192.168.5.3, 5d02h, FastEthernet0/11
    C       3.4.4.0/24 is directly connected, Loopback0
    C    192.168.30.0/24 is directly connected, Vlan30
         64.0.0.0/32 is subnetted, 1 subnets
    O E2    64.59.135.150 [110/300] via 192.168.5.3, 5d02h, FastEthernet0/11
    S    192.168.77.0/24 [1/0] via 192.168.10.2
    C    192.168.10.0/24 is directly connected, Vlan10
         172.31.0.0/24 is subnetted, 4 subnets
    O E2    172.31.3.0 [110/300] via 192.168.5.3, 5d02h, FastEthernet0/11
    O E2    172.31.2.0 [110/300] via 192.168.5.3, 5d02h, FastEthernet0/11
    O E2    172.31.1.0 [110/300] via 192.168.5.3, 5d02h, FastEthernet0/11
    O E2    172.31.0.0 [110/300] via 192.168.5.3, 5d02h, FastEthernet0/11
    O    192.168.11.0/24 [110/3] via 192.168.5.3, 5d02h, FastEthernet0/11
    O    192.168.98.0/24 [110/2] via 192.168.99.1, 5d02h, FastEthernet0/8
    C    192.168.99.0/24 is directly connected, FastEthernet0/8
    C    192.168.20.0/24 is directly connected, Vlan20
         192.168.5.0/31 is subnetted, 1 subnets
    C       192.168.5.2 is directly connected, FastEthernet0/11
         192.168.6.0/31 is subnetted, 1 subnets
    O       192.168.6.2 [110/2] via 192.168.5.3, 5d02h, FastEthernet0/11
    S    192.168.69.0/24 [1/0] via 192.168.10.2
    O*E2 0.0.0.0/0 [110/1] via 192.168.5.3, 5d02h, FastEthernet0/11
    Thanks
    MAhesh

  • ESW 520 24-Port switch with POE not working???

    We just purchased 8 managed switches POE to swap out our existing in preparation for our new phone system.  We installed them all after configuring with static IP.  Deployed... and all but two work fine.  Can someone assist with tips for troubleshooting why two of them do not work?  There are a couple other switches in the building.   Could it be that a switch "upstream" from the two non-functioning switches is causing an issue?  If so, how do I find out?  When we put back the two "dumb" switches all was fine.  Any tips to help would be much appreciated.

    Hi Rachel,
    Thank you for posting. You may need to change the Smartport role of the ESW switch port to match what you are connecting to. If you are connecting to another switch, the role should be switch. This is usually what causes the ports to block traffic.

  • Linksys SRW2016 switch serial console not working

    I have had the switch for about 2 years and recently moved.  The manual specifies:
    38400 bps and 8-n-1 serial port settings using DB9F to DB9F cable.
    I have done this and tried using multiple machines/ports/cables as well as several peices of software (minicom, PuTTy, hyperterminal) and none give me any output from the switch at all.
    The trouble is that in its original config, it had 1 port locked into its own VLAN for management with port security and an obscure RFC1918 IP address which I cannot recall for the life of me.
    At this point, I have no access to TCP/IP management so serial console is my last hope and is not working.
    Any ideas here?

    Hi Tobias, after connecting to the console with the forementioned setting, reboot the switch and tap the enter key several times until the screen shows the post process and loading. If there is absolutely nothing loading the switch may be bad.
    -Tom
    Please mark answered for helpful posts

Maybe you are looking for

  • Gigabit vs. Fast Ethernet (AEBS 802.11n)

    Hi, I have an AEBS 802.11n that I bought back in September 2007. It currently has the 7.2.1 Gigabit Ethernet firmware on it. I want to revert back to older firmware (because of some file transfer problems I have been having) and I see my choices are

  • Blank line in blank file

    I am creating a blank file in which one blank line is getting created.. Is there any way to solve this... I have below config. Acknowledgement.fieldFixedLengths     1 Construction Mode:  create Put file:                    directly File Type:        

  • TS1398 Can't turn on wifi on settings iphone 4 please help

    I can not turn on wifi in settings

  • Are there any iPhone 4 Apps for viewing Numbers Documents?

    I'm wondering if there is any apps for the iPhone 4 which will allow me to view/read Apple Numbers files/documents? I have one for the iPad but was wondering if there is something similar for the iPhone... Thanks in advance...

  • Remote desktop connection. An internal error has occurred.

    Hello, The error occurs from a Windows 7 Home computer to a Windows 7 Professional computer. I connect successfully through a Sonic Wall VPN client. I can ping the IP address of the remote computer. I run remote desktop (using IP address of the remot