Why is it not switching?

it's an incomplete programming, but overall it compiles and shows what I expect to except for the translation part. Can someone tell me why it won't switch the int # of the month into the name of the month?
import java.util.Scanner;
public class LeapYear
public static void main(String[] args)
Scanner kb = new Scanner(System.in);
System.out.println("Enter a date (year month day): ");
int year = kb.nextInt();
int month = kb.nextInt();
int day = kb.nextInt();
if(year < 1582)
System.out.println("Invalid year.");
System.exit(0);
if(month<1||month>12)
System.out.println("Invalid month.");
System.exit(0);
//it doesn't switch from here onwards.
***String englishMonth;***
***switch(month)***
*** case 1: englishMonth= "January"; break;***
***// case '2': System.out.print("February"); break;***
***// case '3': System.out.print("March"); break;***
**/ case '4': "April"; break;***
*** case '5': "May" ; break;***
*** case '6': "June" ; break;***
*** case '7': "July"; break;***
*** case '8': "August"; break;***
*** case '9': "September"; break;***
*** case '10': "October"; break;***
*** case '11': "November"; break;***
*** case '12': "December"; break;*/***
*** default:***
*** System.out.println("Unavailable");***
**}** System.out.println("Date: " + "\t" + month + " " + day + ", " + year);

NewInJava wrote:
if(year < 1582)
System.out.println("Invalid year.");
System.exit(0);
}Fascinating little bit of code! Reminds me of a "bug" I onced fixed
The problem is that the integer 1 is not the same as the character '1'. Remove the single quotes from the numbers in your case statement
edit: actually, it's impossible to really tell why it "doesn't switch" because you've posted code that won't compile
Edited by: georgemc on Mar 3, 2009 5:11 PM

Similar Messages

  • Why would you NOT enable Loop Guard on switch ports?

    Hello
    Why would you NOT enable Loop Guard on switch ports?
    It is disabled by default on all ports.
    Since it prevents loops, in the absence of receiving BPDUs on non-designated ports, why would it not be enabled by default?

    Ziffy wrote:
    The Galaxy S4 supports Google Wallet, but yet you block it from being used. Why exactly? This is not right. I suggest you enable it before you start losing customers. Is there anybody out there that would like to start a petition? Perhaps look into whether or not this is actually legal? Seems like unfair practices to me. Thoughts?
    Good luck with that.  FCC already did and have left it alone...  My theory is because... Google charges carriers to use allow devices to use it.  At one point Sprint paid to go exclusive for wallet.  FCC can't force you to buy your competitors product.

  • Why does my mac not switch focus between applications

    All,
    I have a very inconvenient problem on my mac.
    Every time when I click on a link in e.g. Mail or Twitter, my Mac opens the link in Safari but does not switch focus to the Safari window with the loaded page.
    Similar behaviour in every application.
    Does anyone has an idea?
    Thanks,
    equi

    Carolyn,
    thanks, but this did not solve my problem. The issue is, that Safari itself does not get the focus and I am not brought to the space where Safari has opened the page.
    I tried your suggestion, turned the setting on and off and on again, but the behaviour is still the same. I assume that it has something to do with spaces itself.
    Thanks for your time having responsed to my post,
    equi

  • I can not switch on my mobile why ?

    Could you please suggest me regarding my problem?? I can not switch on my mobile?

    Very vague.
    Charge it?
    Maybe if you were to explain, more help could be given

  • Why am i not able to find iPad documents in the iCloud on my imac

    I believe that I have documents that are saved to the iCloud and then switched to the iCloud drive but I am unable to view those documents on the iCloud online or on my iMac.
    Why can i not find the documents.

    Hi darceyam,
    I'm sorry to hear you are having these issues with iCloud Drive. If you are having issues accesssing your previous files, you may find the following article helpful:
    What if I don't see all my files at iCloud.com?
    Any documents that you've already stored in iCloud are automatically moved to iCloud Drive when you upgrade. iCloud.com will display these files in the new iCloud Drive app in addition to the iWork apps (Pages, Numbers, and Keynote) that you're used to seeing.
    If you don’t see your files in the iWork apps or in iCloud Drive, then make sure that you set up iCloud Drive on all of your devices.
    Get help using iCloud Drive - Apple Support
    Regards,
    - Brenden

  • CK-7W not switching off on bluetooth connection

    Hi,
    Complete noob so please bear with me - trying to upgrade my carkit on the cheap.
    Have just upgraded from a CARK-91 to a CK-7W by just swapping the HF unit, removing the cradle and installing a CU-7 button in the car. No cradle any more - just BT.
    With regards the power I just used a molex converter which converted the 6pin connector to a 4pin. It seems to work fine but the kit does not seem to switch off. I understand that if the IGN sens is not wired the unit will stay on even after the ignition is switched off. But according to the manual it should switch after two minutes if the phone is disconnected.
    When I walk away from the car my phone disconnects. If after 10-15 mins I go bit closer to the car, I can see the CU-7 blue light is on and if I do a search on my phone for audio enhancements it finds the CK-7W.
    When I get in the car my phone does not auto connect again regardless of the ignition until I press the CU-7 button once. The phone then pairs and the car kit beeps.
    So, I dont understand why the blue led on the CU-7 stays on. This suggests the kit is still powered on - but then why does it not auto-pair with the phone until I press the CU-7 button once?
    Any ideas please?

    It sounds like your ck-7w has had a software freeze, try disconnecting the unit for a couple of minutes, then plug back in. Also using a test lamp chack the blue wire to see if there is power there and if it switches off with the key, it may be wired constant live.
    Danny b
    Nokia Accredited Installer
    If my answers help you, give me a Kudos. Its like a pat on the back.

  • Tabstrip control can not switch (Do not respond when focus on field of subscreen)

    Hi Colleagues,
         I have met with a very strange question, which worries me a lot these days. Would you please help me with it?
         The problem is like this:
         1. In normal case, I can switch to another tab when I click it. Please see picture in the attachment (Tabstrip1.png)
         2. But when I click on field on the subscreen of one tab, set focus on one field, in the picture of attachment switch2.png, I can not switch to another tab, it just does not respond. I really do not know why this happens.
         Could any colleague give an answer or hint about it? Thanks a lot!!
         You can access the program by TCODE: EPIC_RPR on EBJ client 003 or QI3 system client700 .
    BR,
    Chris

    yea thats what i thought, thats the most sensible answer that they expect you to
    know it.
    but... have you taken any of the them? would love to hear from someone thats taken a few, i wasn't even sure if i'd put this post in the right forum to be honest.
    just seems odd why they say 95% of the material is in the prep stuff seems too easy.
    i'd have thought that since the cs4 exam had that many more questions that the cs5 exam would have even more prep material but obviously not so.

  • Lumia 635 - MixRadio did not switch

    Broke my Nokia 520, upgraded to Nokia 635. When switching account over Nokia radio did not switch, and now why do I have to buy same product again!
    Moderator's Note: The subject was edited as we have moved the post from an existing thread and created a new topic.

    You don't need to get the same model. As long as you use the same Nokia Account as you used on the previous phone then your account should be there with no problem.
    If you are in India and using the Unlimited service, then it is essential that you used the same Nokia Account otherwise your ophones inbuilt licence has linked to whatever account you did use and that cannot be changed.

  • Att offered me a great deal why shouldn't I switch.

    My fiance and I were at an expo here recently. And ATT offered to pay our ETFs on both our lines, upgrade our note 2 phones, to note 3 phones for free, and we'd have a $65 reduction in our bill. We contacted verizon and all they would offer is for us to switch from 2gb data plan to the lower level of data. Now what kind of matching offer to keep a customer is that. Why shouldn't we switch providers?

    If you can get what is a better deal for your particular situation, then there's no reason you shouldn't switch.
    Verizon doesn't price match.  Never has.
    Just be sure that you are making an informed decision and good luck.

  • Experia z1 screen will not switch on

    hello
    im in need of some serious help.
    myy Sony Experia z will not switch on and i dont know why. i have tried all forms of ways reccommended on the Sony website and also tried using PC Companion to use the software update for phone service but it does recognise my usb conection. 
    please help me or recommend a way for me to fix this problem as soon as possible. 
    P.S i took my phone to mtn and they want to charge me R5500 to fix up this problem while my phone is still under warranty . this is unacceptable. 
    i would prefer direct aid from Sony. 
    Thank you .

    Try to perform a system repair
    Switch off your phone and unplug from Pc (Hold volume up and power for around 10 seconds)
    Start PC Companion and select Support zone then Update my phone/tablet then in Blue Repair my phone/tablet and follow the onscreen instructions - When prompted connect your phone still switched off holding volume down or back button - This should start the repair or reformat process
    If you are using Windows 8/8.1 or a 64bit operating system then adjust the settings for PC Companion and run in compatibility mode and chose Windows 7 or XP
    To add this is a user support forum so the direct aid you speak of will be from your local Xperia care team http://www.sonymobile.com/global-en/support/contact-us/
    For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled.   Richard P. Feynman

  • Why can i not close a tab after i have 2 showing the only why 2 leave that site is 2 exit all tabs and restart firefox

    why can i not close a tab i have 2 close all tabs and restart firefox then selet browse this is verry anoying

    Try the Firefox SafeMode to see how it works there. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    * You can open the Firefox 4/5/6/7 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    If it is good in the Firefox SafeMode, your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • Does anyone know why my iphone keeps switching all of my alert tones and ringtones assigned to contacts? i restored it and it still keeps doing it and now when ever i get a txt or a phone call the tones just sound terrible. how do i fix this?

    does anyone know why my iphone keeps switching all of my alert tones and ringtones assigned to contacts? i restored it and it still keeps doing it and now when ever i get a txt or a phone call the tones just sound terrible. how do i fix this?

    Your only chance is setting it up as new device without using the latest backup afterwards, which you already did.
    If this does not work, you should get it serviced:
    Apple - Support - Service Answer Center
    How to back up your data and set up as a new device

  • Power button will not switch printer off

    I have owned HP products for over thirty years, with little in terms of serious problems. I am rather confused why the power button on my deskjet 8600 plus will not switch off the printer. When I reort to powering off from the wall socket this results in an errror message on re-powering, saying that powering off from wall socket could damage the printer. But there appears to be no fixes? The machine is less than a year old so would appreciate some support.

    Hey @Angus844,
    Welcome to the HP Support Forums!
    I understand that your power button is non responsive on your 8600 machine. I know you stated that you have a Deskjet 8600 but that may be a typo as HP manufacturers an Officejet 8600 Plus. I am going to provide you with troubleshooting steps for the Officejet 8600 Plus model. Be sure to correct me if these steps don't seem to coincide with your model.
    It definitely appears that you are experiencing 'sleep mode' or 'power issues'. I am going to provide you with a support document that should resolve this issue for you:
    The HP Printer Won't Turn On or Respond When the Power Button is Pressed
    Be aware that Solution three: Make sure that the power supply is compatible with the printer, is a generic printer step. You should just have a power cable with no adaptor that goes straight from the printer into a wall outlet. The only lights for power that you should see on your model printer is the green power button on the front of the product.
    If your printer is turning on and functioning, even for a period of time, than your issue does not appear to be power cord related. Therefore, after ensuring that the steps provided in the document above are completed I would like you to run a Firmware Update for your printer.
    The Firmware Update for your printer can be found at:
    HP Officejet Pro 8600 Plus e-All-in-One Printer - N911g Drivers
    After selecting the Operating System of your computer you need to select the Firmware option to download and run.
    Please let me know if these steps resolved your issue. Good luck!
    X-23
    I work on behalf of HP
    Please click "Accept as Solution" if you feel my post solved your issue, it will help others find the solution.
    Click the "Kudos, Thumbs Up" on the right to say "Thanks" for helping!

  • Why pages is not free for me

    why pages is not free for me, i´m just update to maveriks but i can´t download pages, keynote or numbers for free, why?

    The update is available for those using iWork '09. If you have never previously purchased iWork ’09 and have not bought a new Mac since October 1, you will have to purchase the applications. There are several reasons why the updates don't show as free for those who already have iWork '09 installed.
    1. You must have iWork '09 apps installed & they must be updated to the x.3 version. You can also download the standalone updater from this page.
    2. If you are not using English as the primary language for your Mac, change to English & run Software Update. You can then switch back to your preferred language.
    3. Go to Mac App Store (MAS) > Click on Store > Check for Unfinished Downloads. You will need to individually click into each application > Click update > enter in your Apple ID & password and then it will start updating.
    4. Open App Store on your Mac & look at the buttons under Keynote, Pages & Numbers. If it does not say “Update” click Account under Quick Links, enter your password & click “View Account.”  Next, click the “Reset” button to the right of “Reset all warnings for buying and downloading” at the bottom of this page, & click Done. Check your updates tab & iWork & iLife updates should now appear.
    These are the ones I've seen work for others.

  • Why iPhone 5 not charge with its own charger but will with iPhone 4 charger

    why iPhone 5 not charge with its own charger but will with iPhone 4 charger. Thanks to the member who posted that fix.

    It sounds to me like the charger that came with the iPhone 5 is defective, or the cable is if you've been switching the cables when you switch the chargers.
    Regards.

Maybe you are looking for

  • Unable to answer calls in windows 8.1

    Ive been having issues answering and making skype calls since upgrading to windows 8.1 some time ago. Basically I have been unable to connect to incoming calls sporadically. It can take up to as many as 10 attempts before I am succesfully able to joi

  • How do you know what speed discs to use?

    I experienced a problem backing up my iTunes library and found out it might be due to the DVDs that I was using. I have a G4 iMac running 10.3.9. It has a superdrive but I am not sure how to figure out what speed disc to use. Can anyone help? My 16X

  • InDesign CS6 on a Mac OS 10.8 is crashing 75% of the time on startup

    InDesign CS6 on a Mac OS 10.8 is crashing 75% of the time on startup

  • Where is the album artwork when you store songs in an external harddrive?

    I have all my songs on an external flash drive but I have the I-tunes program on the C drive of my windows laptop. In I-tunes I pointed the storage to the E drive and it all works fine. But there is one wrinkle. It looks as if some of the album artwo

  • Connection wtih DataBase in WebStart

    Hi, i actually need to use a applicatio that connect with oracle database, and right now im using servlets to do the connectino over the net. But i was thinking if there is another way to connect to a remote database... is possible to use RMI on the