Another n00b bug lol Boolean prob this time.

Hey,
Got another problem. :(
Ok, the program ask's the user to input a letter from a-e. I decided to create a boolean (progok) to test wether they had entered a letter in this range correctly. I put in a do while (progok = false) loop so that it would keep on asking the user for the letter until they correctly chose a letter in the range from a-e.
Somethings gone wrong in my logic as the programs carries on looping even if the a letter is correctly entered from that range.
Here's the code.
import javax.swing.JOptionPane;
public class LetterProgram2 {
public static void main (String args[]) {
   String pickALet;
   String output;
   char letter;
   int guess;
   int a;
   a=0;
   boolean progok = (a>0 && a<6);
   do{
   pickALet = JOptionPane.showInputDialog ("please enter a lower case letter from (a to e)");
   output = "you selected a letter " + pickALet;
   letter = pickALet.charAt(0);
   switch (letter) {
   case 'a':
   a = 1;
   output = "you entered an a";
   break;
   case 'b':
   a = 2;
   output = "you entered a b";
   break;
   case 'c':
   a = 3;
   output = "you entered a c";
   break;
   case 'd':
   a = 4;
   output = "you entered a d";
   break;
   case 'e':
   a = 5;
   output = "you entered an e";
   break;
   default:
   output = "i did not recognise your entry";
   break;
   JOptionPane.showMessageDialog(null, output, "your letter", JOptionPane.INFORMATION_MESSAGE);
   }while (progok == false);
   guess =(int)(Math.random()*5 +1 ) ;
   System.out.println(guess);
   if (guess==a)
      System.out.println("The computer guessed the correct letter");
   else
      System.out.println("The computer guessed the letter incorrectly");
   System.exit(0);
   }Any ideas?
Thanks

First of all, you never set progok inside your loop. Secondly, using booleans as control varaibles is to be avoided. You don't need one here.

Similar Messages

  • Another Capital One Increase...This time an increase of 4K!

    Background: I opened my Capital One Quicksilver One card in February of this year with a SL of $500 and requested an increase in April. I was automatically approved for a $1,000 increase.  Fast foward to last Saturday night (7/11/15) I decided to try for another CLI because I was nearly maxing out every month on my $1,500 credit line. I needed the ability to make more purchases as well as keep my utilization down. I applied online and received the 2 -3 business day notice. So Monday (7/13) I e-mailed the EO stating my request, my desired increase ($4,000), and reasoning for that desired increase. Yesterday (7/15) I received a call from a very nice woman from the executive office. She asked me a few questions, verified some information, and told me she would be sending my request to the underwriters. She said I would hear something back in 7-10 business days. This morning (7/16) I logged into my account and my credit limit is now $5,500! I am beyond happy with the quality of customer service and the quick turnaround. I'm also enrolled in the credit steps program.  I am due for an automatic incease after my 5th payment. I just made my 5th payment a few days ago and my statement closes tomorrow! I'm curious to see if I'll get that increase as well. I would assume yes, but I'll have to wait and see.  Extra info: I pay my high balances down every month leaving about 1 to 2% utilization reporting on my card.In my EO letter I mentioned that a $5,500 credit limit would match my Discover It credit line (just started reporting) 

    OmarGB9 wrote:
    Grats on the huge cap1 luv!Thank you!

  • Another Boot Camp Question (Internet Security this time)

    Still doing my "homework" to prepare to install Windows (I will be using Vista Ultimate for awhile to start).
    I've been reading a bit here about how Windows can be vunerable just by being connected online.
    My routher does have the firewall on, and I'm also looking at a few security suites (mainly Norton IS 2009 and Kaspersky). Feel free to chime in with recommendations for or against, but my main question is this:
    I assume after installing windows it will update itself. Should I install Windows without being connected, then install a security suite, then reconnect to do updates and registrations, etc? Is there a recommended procedure for that based on anyone's experience?
    Thank you.

    *My NewOsProcedure before iNet connect*
    When you ask youself "In whose best interest is the continuing existance of viruses", the answer is companies who sell Anti Virus software. To protect my access to internet content made possible by software written & constantly being security updated by Microsoft with a second/third party's software is absurd. You don't have to agree with this or believe me saying that I've never suffered for not using one.
    In Windows 7 I admit to missing use of free online One Care mostly for Registry cleaning which I would only trust to Microsoft. Also miss XP Sysintenals utilities that scanned for rootkit & defragmented the registry
    although "Autoruns" still works in W 7 to show things loaded that would otherwise be unknown.
    Windows on first start up leaves you vulnerable to some extent unless you close the holes.
    1)Right click Computer icon Desktop->Properties->Advanced System settings
    ->Remote Tab Disable Remote assistance, make sure Remote desktop is not selected.
    2)From Control Panel->Windows Firewall off by default in earlier releases, differs in windows 7 but be sure that it is turned on. In W 7, using a router I have Home Net blocking everything and Public more open allowing only Core networking element. Disabling Messenger, iTunes Media player as they turn themselves on, does not prevent them from performing acceptably unless perhaps you are sharing media.
    3) In Network connections properties, I retain only Client for MS networks which can be unchecked, QOS Packet Sch, IP 6 & IP 4 and disable items in the "Sharing Tab" which may be new with W 7.
    4) Right click Computer icon Desktop->Manage->Services&Apps->Services -
    Depending on whether you are sharing, using remote desktop, wireless, things I'm not into, these are services that I disable (Some may not be on pre
    W 7:)
    Bluetooth, Branch Cache, Computer Browser, Home Group, Internet connection Sharing, iPod, Media Center Extender, Net.Tcp Port Sharing, Offline Files, Peer anything, PNRP machine name pulication, Remote Access Conn..., Remote Destop (all), Remote Registry, Routing & Remote access, Secondary Logon, Server, Smart Card, Tablet PC, UPNP device host, Windows Biometric, Wind. Card space, Windows Connect Now, Windows M. Player Sharing, Windows Remote Mgmt, Windows Search (this is personal, I disable drive indexing as well etc. I've seen that Ms. has included *Wolfram Alpha in Bing. *Who's gonna bother arguing with a MacArthur Genius if he suggests that the Universe is a giant computer? ), WinHTTP web Proxy..,WLan AutoConfig and WWAN AutoConfig. In Services, you do not want to disable anything critical to OS start up.

  • Another Scrabble Bug

    When the iPod is connected to an external speaker, For example, a Bose external amplifier/speaker for the iPod, switching music "off" actually turns the music off. This is good.
    Um, not so with EA Scrabble for the iPod. When it plays its (annoying) background sounds, and one selects "off", it says, "uh uh, let me annoy you more fully" and turns the music back on.

    I think i've found another bug with setBundledExceptionMode(true), this time regarding dates.
    If you are using the oracle.jbo.format.DefaultDateFormatter then even with setBundledExceptionMode(true), a java.text.ParseException gets thrown IMMEDIATELY if the inputed date format is incorrect.
    I got around this problem by subclassing oracle.jbo.format.DefaultDateFormatter and catching the java.text.ParseExceptionThis is not a DATE only issue. Formatting service as a whole currently sits outside of Bc4J runtime apis and thus "does not" honor Bc4J settings like exception mode etc.
    JSPs need to "wrap" such exceptions and honor bundling of exceptions by going thru' the rest of the attributes. I'd log a bug for JSP code=gen for this.

  • Another setBundledExceptionMode bug?

    To the JDEV team,
    I think i've found another bug with setBundledExceptionMode(true), this time regarding dates.
    If you are using the oracle.jbo.format.DefaultDateFormatter then even with setBundledExceptionMode(true), a java.text.ParseException gets thrown IMMEDIATELY if the inputed date format is incorrect.
    I got around this problem by subclassing oracle.jbo.format.DefaultDateFormatter and catching the java.text.ParseException
    =============================================================================
    import oracle.jbo.format.DefaultDateFormatter;
    import java.text.ParseException;
    * This class will be used by the BC4J framework application "bc4j.ear".
    * Due to the above, this class needs to be treated as a BC4J framework class
    * and therefore needs to be added to a jar in the OC4J classpath
    public class CustomDateFormatter extends DefaultDateFormatter {
         public CustomDateFormatter() {
              super();
         * This method has the same functionallity as the super class DefaultDateFormatter.parse()
         * except that it traps any ParseExceptions so that "bundled exceptions" work correctly in
         * the BC4J framework
         public Object parse(String formatString, String parseThisString) throws ParseException {
              try {
                   return super.parse(formatString, parseThisString);
              } catch (ParseException e) {
                   return null;
    =============================================================================

    I think i've found another bug with setBundledExceptionMode(true), this time regarding dates.
    If you are using the oracle.jbo.format.DefaultDateFormatter then even with setBundledExceptionMode(true), a java.text.ParseException gets thrown IMMEDIATELY if the inputed date format is incorrect.
    I got around this problem by subclassing oracle.jbo.format.DefaultDateFormatter and catching the java.text.ParseExceptionThis is not a DATE only issue. Formatting service as a whole currently sits outside of Bc4J runtime apis and thus "does not" honor Bc4J settings like exception mode etc.
    JSPs need to "wrap" such exceptions and honor bundling of exceptions by going thru' the rest of the attributes. I'd log a bug for JSP code=gen for this.

  • Another Coverflow bug?

    On my Classic 160G, after scrolling through coverflow and selecting the an album I want to hear, I push the center button and once the album begins to play, I have the following problem.
    Once the album begins to play, if I press the menu button to go back up a level (to coverflow) the iPOD continues to play, but the controls lock up for 30 seconds. The music continues to play and after 30 seconds, the iPOD unfreezes and the time bar moves to the correct location in the song.
    It's like during play the menu button is locked? I can move back and forth between songs and pause, but not up a level.
    However, if I pause the track and push the menu button, after the 30 second freeze, it goes to coverflow.
    I have firmware 1.0.1 and all my songs are MP3 @ 192. Is anyone else having this problem or am I headed back to the store for an exchange?

    I think i've found another bug with setBundledExceptionMode(true), this time regarding dates.
    If you are using the oracle.jbo.format.DefaultDateFormatter then even with setBundledExceptionMode(true), a java.text.ParseException gets thrown IMMEDIATELY if the inputed date format is incorrect.
    I got around this problem by subclassing oracle.jbo.format.DefaultDateFormatter and catching the java.text.ParseExceptionThis is not a DATE only issue. Formatting service as a whole currently sits outside of Bc4J runtime apis and thus "does not" honor Bc4J settings like exception mode etc.
    JSPs need to "wrap" such exceptions and honor bundling of exceptions by going thru' the rest of the attributes. I'd log a bug for JSP code=gen for this.

  • How do I use the time capsule to share itunes music between multiple apple devices? Also, is it possible to control the music on one device using another, and how do you set this up?

    How do I use the time capsule to share itunes music between multiple apple devices? Also, is it possible to control the music on one device using another, and how do you set this up?

    unless i'm missing something, i think you got mixed up, this is easy google for walk throughs
    i'm assuming this is the new 3tb tc AC or 'tower' shape, if so, its wifi will run circles around your at&t device
    unplug the at&t box for a minute and plug it back in
    factory reset your tc - unplug it, hold down reset and keep holding while you plug it back in - only release reset when amber light flashes in 10-20s
    connect the tc to your at&t box via eth in the wan port, wait 1 minute, open airport utility look in 'other wifi devices' to setup the tc
    create a new wifi network (give it a different name than your at&t one) and put the tc in bridge mode (it may do this automatically for you, but you should double check) under the 'network' tab
    login to your at&t router and disable wifi on it
    add new clients to the new wifi network, and point your Macs to the time machine for backups

  • I have an iPad 2 with iOS 5.1 and iBooks version 2.1.1. I have 64GB of storage, 80% is used. iBooks is using 250MB of storage. I have a large number of PDF files in my iBooks library. At this time I can not add another book or PDF file to my library.

    I have an iPad 2 with iOS 5.1 and iBooks version 2.1.1. I have 64GB of storage, 80% is used. iBooks is using 250MB of storage. I have a large number of PDF files in my iBooks library. At this time I can not add another book or PDF file to my library.  When I try to move a PDF file to iBooks the system works for a while...sometimes the file appears and than disappears....sometimes the file never appears. Is ther some limit to the number of books or total storage used in IBooks?  Thanks....

    Hi jybravo70, 
    Welcome to the Apple Support Communities!
    It sounds like you may be experiencing issues on your non iOS 8 devices because iOS 8 is required to set up or join a Family Sharing group.
    The following information is located in the print at the bottom of the article. 
    Apple - iCloud - Family Sharing
    Family Sharing requires a personal Apple ID signed in to iCloud and iTunes. Music, movies, TV shows, and books can be downloaded on up to 10 devices per account, five of which can be computers. iOS 8 and OS X Yosemite are required to set up or join a Family Sharing group and are recommended for full functionality. Not all content is eligible for Family Sharing.
    Have a great day, 
    Joe

  • So is there a fix for this Time Zone bug?

    apple, is there a fix to this Time Zone bug in Calendar?

    You are not talking to Apple, just other Apple users. If you are experiencing something you think is a bug, you will have to describe it or reference some description. I am unaware of any specific Time Zone bug.

  • Contacts cannot be synced at this time because another computer is currentl

    Just got to say, mobile me is incredibly fragile. Apple should rename the service mobile beta.
    I have two problems,
    1) "Contacts cannot be synced at this time because another computer is currently syncing this data". I have two PCs and made some changes to the adress book. Now I get this error every fifteen minutes on my work PC. This is incredibly annoying. I am guessing that there is a dialog box displayed on my home PC warning that more than 5% of my data has changed and do I want to continue.
    Apple, please take this dialog box out of the Sync transaction operation otherwise it looks the entire process for all clients, if a user cannot access their PC at that moment to respond to the dialog.
    2) I created a new Address book Group on the server/cloud and populated it with several addresses. On my iPhone the group is shown but it is empty. Is this possibly related to the problem (1)?.
    Anybody have any suggestions? Is my idea about the cause correct?

    You could try again later but usually, that message means that the server detected a jailbroken device. Has your iPad been hacked or jailbroken? Or, has your computer been used with a hacked or jailbroken device?

  • TS1702 I have 8 apps that when I tried to update, are now stuck on "installing" in the box that says update. every time  I try to update another app, it gets frozen like this as well. I was able to quit all apps, but these, as they do not respond. Any ide

    I have 8 apps that, when I tried to update, are now stuck on "installing" in the box that says update. every time  I try to update another app, it gets frozen like this as well. I was able to quit all apps, but these, as they do not respond. Any ideas?

    Reset your iPad by holding the home and on/off buttons together for 6 or 7 seconds till the Apple logo appears.  Then update your apps one at a time.  Do not start the next app until the current one downloads and finishes installing.

  • TS1702 When i purchased the APP dead space it got like 1/4 of the installing it then a window popped up saying the app can't be downloaded at this time has happened with another app aswell can anyone help me ?

    everytime i try installing big app like FIFA and DEAD SPACE it get half way through installing then a window pops u saying cannot download this app at this time can anyone help?

    I suggest trying the update again after an hour or two.  Sometimes, the notice that an update is available comes an hour or two before the developers actually sends the revised app out to be downloaded.

  • [help me] Oracle 10G + ASM "ORA-00376: file 5 cannot be read at this time"

    We have used Oracle 10G R2 RAC + ASM on Redhat 4 (EMC cx700 Storage)
    I found below errors on alert log and can't inserted, updated and deleted datas in database.
    Sun May 27 01:12:34 2007
    SUCCESS: diskgroup ARCH was mounted
    SUCCESS: diskgroup ARCH was dismounted
    SUCCESS: diskgroup ARCH was mounted
    SUCCESS: diskgroup ARCH was dismounted
    SUCCESS: diskgroup ARCH was mounted
    SUCCESS: diskgroup ARCH was dismounted
    Sun May 27 01:19:11 2007
    Errors in file /oracle/product/admin/DB/udump/db3_ora_15854.trc:
    ORA-00376: file 5 cannot read at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    ORA-00376: file 5 cannot be read at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    ORA-00376: file 5 cannot be read at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    ORA-00372: file 5 cannot be modified at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    So:
    I checked and recovered data file
    SQL> select name,status,file# from v$datafile where status ='RECOVER';
    NAME
    STATUS FILE#
    +DATA/db/datafile/undotbs3.257.617849281
    RECOVER 5
    RMAN> run {
    allocate channel t1 type 'SBT_TAPE';
    allocate channel t2 type DISK;
    recover datafile 5;
    recover completed.
    SQL> alter database datafile 5 online;
    Butttttttttttttttttt:
    What is going on?
    I checked EMC storage, not found any disk error.
    I checked alert log of ASM, no found anything.
    I don't know What the problem ?
    Because I had the same problem 2 days ago.
    This day error on undo datafile node 3.
    2 days aGo; error on undo node 4.
    Please please anybody
    What bug or anything wrong ?
    Please introduce me
    trace file:
    /oracle/product/admin/DB/udump/db3_ora_15854.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    ORACLE_HOME = /oracle/product/10.2.0/db
    System name: Linux
    Node name: db03.domain
    Release: 2.6.9-42.ELsmp
    Version: #1 SMP Wed Jul 12 23:32:02 EDT 2006
    Machine: x86_64
    Instance name: DB3
    Redo thread mounted by this instance: 3
    Oracle process number: 65
    Unix process pid: 15854, image: [email protected]
    *** SERVICE NAME:(DB) 2007-05-27 01:19:11.574
    *** SESSION ID:(591.62658) 2007-05-27 01:19:11.574
    *** 2007-05-27 01:19:11.574
    ksedmp: internal or fatal error
    ORA-00376: file 5 cannot be read at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    ORA-00376: file 5 cannot be read at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    ORA-00376: file 5 cannot be read at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    ORA-00372: file 5 cannot be modified at this time
    ORA-01110: data file 5: '+DATA/db/datafile/undotbs3.257.617849281'
    Current SQL statement for this session:
    INSERT INTO DATA_ALL VALUES (:B1 ,:B2 ,:B3 ,:B4 ,:B5 ,:B6 ,:B7 ,:B8 ,:B9 ,:B10 ,:B11 ,:B12 ,:B13 ,:B14 ,:B15 ,:B16 ,:B17 ,:B18 ,:B19 ,:B20 ,:B21 ,:B22 ,:B23 ,:B24 ,:B25 ,:B26 ,:B27 ,:B28 ,:B29 ,:B30 ,:B31 ,:B32 ,:B33 ,:B34 ,:B35 ,:B36 ,:B37 ,:B38 ,:B39 ,:B40 ,:B41 ,:B42 ,:B43 ,:B44 ,:B45 ,:B46 ,:B47 ,:B48 ,:B49 ,:B50 )
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    0x21dc2b4b8 780 package body MGR.AC
    0x21e4815b0 3 anonymous block
    ----- Call Stack Trace -----
    calling call entry argument values in hex
    location type point (? means dubious value)
    ksedst()+31 call ksedst1() 000000000 ? 000000001 ?
    7FBFFF7290 ? 7FBFFF72F0 ?
    7FBFFF7230 ? 000000000 ?
    ksedmp()+610 call ksedst() 000000000 ? 000000001 ?
    7FBFFF7290 ? 7FBFFF72F0 ?
    7FBFFF7230 ? 000000000 ?
    ksupop()+3581 call ksedmp() 000000003 ? 000000001 ?
    7FBFFF7290 ? 7FBFFF72F0 ?
    7FBFFF7230 ? 000000000 ?
    opiodr()+3899 call ksupop() 000000002 ? 000000001 ?
    7FBFFF7290 ? 7FBFFF72F0 ?
    7FBFFF7230 ? 000000000 ?
    rpidrus()+198 call opiodr() 000000066 ? 000000006 ?
    .......etc.............................
    Message was edited by:
    HunterX (Surachart Opun)

    To me it looks like your undotbs on node3 is filled and not marking old undo as expired. Use this query to find out if it is labeling old undo as expired.
    SELECT tablespace_name, status, COUNT(*) AS HOW_MANY
    FROM dba_undo_extents
    GROUP BY tablespace_name, status;
    Another thing I noticed from your alertlog is it is only doing that on undotbs3, which I assumes is on node3.
    1) try recreate undotbs on node3
    2) take node3 out of service (stop nodeapps, ASM, instance and finally CRS on node3) and see if you can do DML on your database.
    -Moid

  • Solo Track : another weird bug ?

    Year after year, I find more and more annoying bugs in Logic Pro. This time it's the Solo Track button that act weird :
    Take track with regions.
    Activate the Solo button on that track.
    Move a region from another track (that is not in Solo) to the Solo'ed track : this region WON'T BE PLAYED !!!
    You NEED to un-Solo and re-Solo the track in order to include the new region...

    I think I figured this one out. If you are soloing the regions, and you move a region that isn't soloed onto the track, that region will not become soloed. If you solo the track without any regions selected, then when you move a region from an unsoloed track, it activates....
    I think. Don't have Logic in front of me right now to test.

  • Unable to log in to the user account (name) at this time

    I get this error message when I try to log-in in my main admin account. And this is not a lost password issue I know im typing the write password because when I type a wrong one the box shakes when I type the right one it gives me that message.
    I tried alot of stuff to gain access to it but I cannot, the only thing that I can do is go in as root user and extract the files that I had in there, but I have no physcial access to the login it self, I started making a different account name for it but I dont want to lose all my prefrenses although I think the only thing that is making it this way is File Vault (its swtiched on for the locked out account)
    Any thoughts?

    I'm also getting the dreaded "You are unable to log in to the user account __ at this time" but believe this happened when I inadvertently tuned off an external hard drive without ejecting it first. At first, I thought it was a File Vault problem, but my user.sparseimage file is still there and accessible once I changed the permissions to those of another user account.
    What I have come to believe, based on other postings I have read on this topic, at least in my case, is that I must have corrupted the logged in user on the netinfo file. The solutions I've seen so far for fixing the netinfo file seem pretty complicated, though I do have a backup of that file.
    I have yet to decide whether the netinfo problem is easily fixable or if I would better employ my time moving my iTunes and iPhoto files off that sparse image and into another user account. I'm open to suggestions.
    Bill
    iBook G-4   Mac OS X (10.4.7)   1.33 GHz, 768 MB memory, 60 GB HD, iPod Shuffle

Maybe you are looking for

  • No Phone Number for a reason

    May 10th 2015. My Skype started having this problem a day ago. When I open the Skype application and click to call a friend (whose status is online or away) the call just says it is "Connecting" for about 30-45 seconds. Then the call stops/drops and

  • Install the console design of Oraclar Identity Manager 9.1.0.2 on Linux

    Hello friends, You can install the console design of Oracle Identity Manager 9.1.0.2 on Linux Thanks

  • Account user images

    How do I delete and have no image in my account user. I currently have the soccer ball showing up in all email and I tried changing the image with a jpeg file but it will not change it on the email even though it shows changed in the user account. I

  • InfoPath 2013 form will not open in browser

    Greetings All, I have a scenario where I have created a InfoPath 2013 form and it will not open in the browser; it always opens it in the rich InfoPath client. The only thing I have done differently here is to apply a content type, from the content t

  • Auto Save & Versions a bust ... bring back "Save As"

    Having upgrading my laptop to Lion and discovering that along with Auto Save and Versions comes the elimination of the Save As command and the inability to turn these new features off I will be reinstalling Snow Leopard and definitely not upgrading o