Cannot get program to compare two statements

My program is working fine other than when it supposed to check to conditions against each other. I'm not sure why but it just seems to skip it without even trying (I imagine I have incorrect syntax or something)
roll is defined earlier in the same class (and by same way with random numbers) as roll2
while (true) {
die1 = (int)(Math.random()*6) + 1;
die2 = (int)(Math.random()*6) + 1;
roll2 = die1 + die2;
System.out.println(roll+" First");
System.out.println(roll2+" next");
if (roll2 == roll) {
System.out.println("IM IN THE FIRST LOOP!");
wins = wins + 1;
break;
else if (roll2 == 7) {
System.out.println("IM IN THE 2nd LOOP!");
losses = losses +1;
break;
I just don't get why it won't check roll2 against the value of roll as well as pass over roll2 == 7 when the value of roll2 is equal 7! I'm sure this an extremely n00b question but any help is appreciated.

i do need to exit that while loop. Heres the main chunk of code, should help make a little more sense.
if (c == 'i') {      //program enters loop if user inputted "i"
while (x == 'y') {  //x is initially assigned character "y"
while (true) {
die1 = (int)(Math.random()*6) + 1; //randomly assigns value to die1
die2 = (int)(Math.random()*6) + 1; //randomly assigns value to die2
roll = die1 + die2;
rollz = checkroll(roll); //value of roll is sent to be checked and returned
if (rollz == 0) {       //if user loses the game, this loop is entered
losses = losses + 1;
games = games + 1;
break; }
else if (rollz == 1) {  //if user wins the game, this loop is entered
wins = wins + 1;
games = games + 1;
break; }
else {         //if user needs to roll again, process starts over
while (true) {
die1 = (int)(Math.random()*6) + 1;
die2 = (int)(Math.random()*6) + 1;
roll2 = die1 + die2;
System.out.println(roll+" First");
System.out.println(roll2+" next");
if (roll2 == roll) {
System.out.println("IM IN THE FIRST LOOP!");
wins = wins + 1;
break;
else if (roll2 == 7) {
System.out.println("IM IN THE 2nd LOOP!");
losses = losses +1;
break;
break;
System.out.println("Would you like to play again? (y or n)");
x = TextIO.getlnChar(); //x is assigned character user inputs from TextIO.java
if (x == 'y') //user plays another game if they choose 'y'
System.out.println("Starting new game. ");
else if (x == 'n') {      //user ends game play and loop is exited
System.out.println("Thanks for playing. ");
break;
Edited by: winman15 on Sep 14, 2007 11:57 AM

Similar Messages

  • Cc2014 loads then closes. cannot get program to run

    my cc2014 will load, then pop up states program closed. cannot get it to run.

    I did read those tutorial files and the CATALINA_HOME and JAVA_HOME are set correctly- these were set just the same on another computer the other night and it worked fine and ran the first time.
    The docbase is pointing to ROOT - as far as i can see in the server.xml file
    - i've tried installing it on a newly installed windows 2000 machine- and it won't work on it either- is it maybe something with windows 2000?
    i'm using the java sdk 1.4.1 and using tomcat 4.1.24 and windows 2000.
    more help would be appreciated, i don't know what i will do if i cna't get this working- i have a week to come through on the project that depends on it.

  • New user - cannot get programs to work??

    I just signed up for the full version of creative cloud and paid the $49.95.  When I try to open the applications, that were previously installed as the trial versions, they still wont open?  How do I get the programs to work?
    Annoying.  It is still asking me for a licence number?  Am I meant to have one?  Do I need to reinstall all programs???!!
    Some better instructions would be great Adobe....!
    The email you sent is not very helpful... Surely I am not the only person who downloaded the trial versions before subscribing... Your email is worded that I need to download the programs to make them work...
    How to get started:
    1. Log in http://www.adobe.com/go/cc_appsservices_au?trackingid=KDUMO to Creative Cloud with your Adobe ID and password.
    2. Choose products to download on the Apps page.http://www.adobe.com/go/cc_appsservices_au?trackingid=KDUMO
    3. Need Help? Visit the Download and Installation Support Center.http://www.adobe.com/go/cc_downloadhelp_au?trackingid=KDUMM

    Hi GennoAustralia,
    To license your already installed products running in trial, please follow below instructions:
    1. Remove all adobe entries present in host file. Host file is located at: C:\Windows\System32\\drivers\etc\hosts(win)  and /private/etc/hosts(mac)
    2. Launch any of your product,you want to license.Follow step a) or b) whichever applicable:
    a) If you have bought subscription for same adobe id which you used while installing your product in trial, you will get a "Sign In" screen. Click on "SIgn In", your      product is now licensed.
    b) If your adobe id having subscription is different from adobe id used while installing product in trial, a trial screen which has two butttons : "License This Software" and "Continue Trial" is shown. Click on "License This Software". On next screen,  click on "Not your Adobe Id" and enter the adobe id carrying subscription.
    You will now be able to license your product.
    Thanks,
    Manjri

  • I cannot get out of a frozen state on my iPad. It is showing Itunes and usb connection images on screen

    PLease help me get my IPAD out of this frozen state. It is showing the Itunes and USB connection image. It will do absolutely nothing! HELP!!!

    Recovery Mode
    1. Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
    2. Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.
    3.While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
    4. Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears, release the Home button. iTunes should alert you that it has detected a device in recovery mode. Click OK, and then click Restore to restore the device.
    Note: Data will be lost. You may have to repeat the above many times.

  • Cannot get program information on tv channels

    He had a power problem and when I got the power on the internet did not come up. I called verizon and they did some tests on their end and then had me reset the router. Today I find the program information and on demand is not there. It is saying they do not recognize the box is offline. I tried rebooting the set box but it didn't help. Any suggestions

    You can call tech support and have them reset the STBs, or login at my Verizon and there is a way you can do it yourself. All indications show your TV hardware can not reach the internet.
    If you are able to login at the router you can always look at the STBs and test the connection from the router to the STB. If your router can not see the STBs, then you have a router, STB, or wiring issue.
    I had one of my QIP-2500 STBs go down today after I had it unplugged for about 20 minuites, and this worked for me. It would not do anything. Just straight lines across the display. I didn't need to call support.
    The easier way may be to run the VZ In Home Agent software on your PC. It will do many things for you.
    http://forums.verizon.com/t5/FiOS-TV-Technical-Assistance/FiOS-TV-Technical-Assistance-with-VZ-In-Ho...

  • Failed to compare two elements in the array

    very often, I have the error "Failed to compare two elements in the array" in Exchange 2013 ECP. We are not running DAG. I google a bit but don't get a lot of result on this.
    I was trying to track mail from a user who send to DL group. Since I can't do in in ECP , how can I do it in EMS?

    I too have this issue.  I'm not sure how wide spread.  I know of one user who sends emails regularly to a DL named "All Users" which is a Security Group which we then add real users to and not just every mailbox.  When he sends the emails,
    from his perspective, everything is fine, meaning he gets to NDR or anything.  Also, when he adds the Dl in Outlook To field and expands it, all the correct users are there.  In fact, it tells him there are 203 addresses here.  However, only
    184 are actually getting the message.  When I try the EAC to view the tracking report, it will show the message, but if I click on the edit button, I get "Failed to compare two elements in the array".  If I try from EMC with search-messagetrackingreport
    -identity "recipient address" -sender "sender address" -bypassdelegatechecking and the recipient address is the group, it says it could not be found.  If I try with simply putting an email address of someone who is a member of that group, it says Warning:
    An unexpected error has occured and a Watson dump is being generated.  Failed to compare two elements in the array.  I don't know what else to try.  Anybody??

  • HELP : Comparing two programs(DEV & PROD)

    Hi,
    I want to compare two programs one from dev and other from prod and check whether it is identical or not....the number of programs are in thousands.....so is there any FM or program so that i can automate it.....plz help!!

    Hi Ajay,
    i have solution for ur problem.
    1. Go to program -> utilities-. version-> versiopn management.
    2.u arrive at new screen.
    3.type /h to make debuggin on.
    4. now click any push button for comparison..
    5.in field textbox of debbuger , type 'SY-UCOMM' to get the ok_code for that push-button.
    6.once u get the ok_code , u can use
    'CALL TRANSACTION 'SE38' USING BDC_DATA '.
    7.To get more details on such kind of abaP statement , select that statement and press F1 , you wud get reference example out at bottm..
    8. refere to that along with also check out for screen no , prohram name , ok_code , which are needed for that transaction.
    regards
    Note: reward points if useful

  • I have two faults! 1, an error comes up in Ps CC 2014 "could not apply the saved panel configuration, restring to default and my tools have disappeared completely and anything ive tried I cannot get them back not even the drop down menu in 'window' helps

    I have two faults! 1, an error comes up in Ps CC 2014 "could not apply the saved panel configuration, restring to default and my tools have disappeared completely and anything ive tried I cannot get them back not even the drop down menu in 'window' helps at all. And 2, Lr everytime I load it up it gives me the option to retry or switch to and it takes a while for me to even get anywhere with it I think it has something to do with the catalogs? I've been using these programs for a few years now on a Mac...no problem but when I use a PC when I'm away coz it's the (only) comp available these happen PC's are so useless! Please can anyone help??...

    I can give a few suggestions on Photoshop CC 2014, but Lightroom is a separate forum and you should ask Lr questions there.
    First close Photoshop.
    Then start Photoshop by double-clicking on it's icon and very quickly after that, hold down the ctrl-alt-shift keys until you see the reset dialog. answer "Yes" to delete settings, and let Photoshop continue to load.
    It's tricky to do and may take a few tries, but at least it should reset Photoshop CC 2014 to defaults.
    Gene

  • BUG? BRIDGE statement to compare two tables

    Hello,
    I tried to compare two tables in different dbs and remembered a post about Cross Connectin Queries
    http://barrymcgillin.blogspot.com/2010/11/cross-connection-queries.html
    BRIDGE temparb AS "EB05 01"
    (SELECT * FROM arb)
    (SELECT * FROM temparb
    MINUS
    SELECT * FROM arb
    UNION ALL
    (SELECT * FROM arb
    MINUS
    SELECT * FROM temparb
    );I would expect to get the differences between the table arb in my current schema and the table arb alias temparb in the other db. Yet it seems, that in this case only the table in my current schema is read.
    I materialize the BRIDGE table with
    BRIDGE temparb AS "EB05 01"
    (SELECT * FROM arb)and select the value I know to be only in the remote schema
    SELECT id FROM temparb WHERE id = 2562;
    SELECT id FROM arb WHERE id = 2562;Both times I get no result. I even tried to use aliases on the table, same result. Tested in 3.0 and 3.1 EA3.
    Has anyone tried this before?
    Regards
    Marcus

    Hi Marcus,
    Have you tried it without the double quotes around the connection name?
    I have a connection called
    system_local
    which I run the following command in
    drop table testbridge_remote;
    drop table testdbrige;
    create table testbridge(col1 int);
    insert into testbridge values (1);
    insert into testbridge values (2);
    insert into testbridge values (3);
    commit;
    I have a connection called
    Connection Name With Space
    which I run the following in
    drop table testdbrige;
    create table testbridge(col1 int);
    insert into testbridge values (4);
    insert into testbridge values (5);
    insert into testbridge values (3);
    commit;
    Then in the system_local connection/worksheet I can run the following statement
    BRIDGE testbridge_remote as Connection Name With Space(select * from testbridge)
    +(SELECT * FROM testbridge_remote+
    MINUS
    SELECT * FROM testbridge
    +)+
    UNION ALL
    +(SELECT * FROM testbridge+
    MINUS
    SELECT * FROM testbridge_remote
    +);+
    It works ok.
    Returning rows in the remote table not in the local table , and rows in the local table not in the remote table .
    Regards,
    Dermot
    SQL Developer Team.

  • Comparing two text files in a UNIX using shell programming

    Hi All,
    Sorry for posting a UNIX shell query on Database forums.
    I want to compare two text files using shell programming. The two text files are actually Business Objects output extracted in a text format. The two output files are not in a tabular format and are no way similar in looking. I want to take one file e.g. file1 as an input file and compare each line of file1 with the other file e.g. file2. During comparison I want to extract the differences found in another file and if possible the similar data as well.
    Below is how the files will look like
    File 1:
    BILL1000000 1111251 122222
    RMG1A2 023425100000000010001 11135 102650111100
    UHL1 *6999999* *454540001* Weekly *000*
    0544424556895PS DATA 01MPS100000/03 MR A A PERTH UTL1234567893106923455053106900000010000005
    File 2:
    AUTO
    APPLICATION=STARTPOINT
    START
    PROCESSING DATE=01012011
    1598301270320099TEST C E 00000031615 123456
    7854301276140499TES P 00000062943 234567
    UHL1 *6999999* *454540001* Weekly *000*
    5569931233333499/123456789 00000013396 345678
    4471931233333499ER K J 00000031835123456789012456789
    33652931233333499E J L 00000034729123456789012567890
    45783123333349921/123456789 00000039080 678901
    1452931233333499T R 00000040678123456789012789012
    59689312333334994/987654321 00000048614 890123
    4112931233333499/987654321 00000060631 901234
    1236931217836899 K S 00000043704 012345
    END
    As you can see above the file are not at all matching except for one record UHL1, but its just an example. As an output I would like to have a third file containing all these records, highlighting the differences, and a fourth file where in only the matched records should get populated.
    Please post any useful scripts related to the above scenario.
    Many Thanks.
    Edited by: 848265 on 06-Apr-2011 04:13

    Hi;
    For your issue i suggest close your thread here as changing thread status to answere and move it to Forum Home » Linux which you can get more quick response
    Regard
    Helios

  • After trial with adobe pro XI I ordered the program ($14.95). Order has been confirmed. But I cannot get it to download on the computer in question. I continually end up back with trial program. How do I get to my full, non-trial system?

    Used trial version of AA pro XI.  now tried to order regular XI version ($14.95/ mo.). Order went thru but now I cannot get access to the newly ordered program.  What do I need to do?

    I am handicapped right now, i.e., the machine I wanted to load with the AA pro  XI is at home and I am at work right now.  Through work I have AAproXI loaded on two machines (here in my office).  I'll have to fuss with the home machine tonight. Thanks for your help.  I may need to radio back to you.
               J. Craig Currie
    [cid:[email protected]]  
    1600 Market Street, Suite 2500 - Philadelphia, PA 19103
    [email protected]<mailto:[email protected]> - www. phillylaw.net
    T: 215-564-0833 - Toll Free: 877-478-8529 - F: 215-523-7911

  • Error cannot get new token due to device offfline state

    I cant download any app from appworld or even cant access into Myworld. Its says "Cannot get new token due to device offline state.(Error id:40760)"
    i reinstalled the appworld but its the same thing happening.Besides i have reset my BBID pasword through email as i forgot that. when i try to access in my mobile's bbid it says"Unable to update Blackberry ID account informtion while offline".
    it seems smthing wrong with the "offline state".Actually whats this thing?. i am using curve 9300 without BES or BIS but with the normal edge internet enabaling apn settings for five months.every thing was fine.but this problem is occuring for two days.my browser and other installed apps working fine but not the appworld.Please Help me....................

    Hi,
    I have the same problem, cant download any app from appworld or even cant access into Myworld. Its says "Cannot get new token due to device offline state.(Error id:40760)"
    I am using Bold 9700  without BES or BIS but with the normal edge internet enabaling apn settings for five months.every thing was fine. But this problem is occuring for two days.my browser and other installed apps working fine but not the appworld.Please Help me....................

  • Just bought 2 Apple 6 plus phones. Cannot get my husbands email to connect. He works for the state and not sure if that is the problem or not. All his information is correct.

    Just bought two new iPhone 6 plus phones.  Cannot get the email to load on my husbands phone for his work.  He works for the state and I don't know if that is the issue or not.  Any suggestions?

    Your husband should contact his IT department at work to find out if he is allowed to set up his work email on his personal device and if so, how to do it.

  • HT1751 I foolishly tried to set up two libraries for two diff. ipods. Now my original library is changed and all the music I purchased is not listing.   In purchased I see 906 songs - but I cannot get them to show up as a list - is there help out there?

    I tried to set up two libaries so my two ipods could sync different kinds of music. This wiped out my original Itunes - I have been trying to get it back to the way it was.  I have is backed up on Simple Save but do not want to plug that aback in since I am afraid it will then take up the new situation instead of allowing me to put the data on simple save back to the computer for Itunes.   I want to show my 908 songs that I have purchased and I cannot seem to do this... It shows in purchased= as 0-8 - but I cannot get them to list.   What am I doing wrong.  I know I should have left it alone and never attempted something I know nothing about~  Thanks

    I tried to set up two libaries so my two ipods could sync different kinds of music. This wiped out my original Itunes - I have been trying to get it back to the way it was.  I have is backed up on Simple Save but do not want to plug that aback in since I am afraid it will then take up the new situation instead of allowing me to put the data on simple save back to the computer for Itunes.   I want to show my 908 songs that I have purchased and I cannot seem to do this... It shows in purchased= as 0-8 - but I cannot get them to list.   What am I doing wrong.  I know I should have left it alone and never attempted something I know nothing about~  Thanks

  • I have two apple accounts that I cannot get to merge as one.

    I have two apple accounts that I cannot get to merge.  One is a hotmail address and the other a gmail address as primary addresses in the two accounts. I would like to merge them into one account.  I cannot verify the addresses of either accounts because when I do it will say that the address already exists.  Therefore I can't get them to merge.
    Also...
    Me.com and hotmail are under the same account., but when I log into me.com some of the accounts turn into the hotmail account.  I do not use hotmail anymore and use gmail regularly.
    Any insight to these problems would be appreciated.

    If these are both used as Apple IDs, then they cannot be merged. If they are just two email accounts of which you only wish to use one, then you would need to transfer the data you want to save from one to the other. Since the data are just email you would need to look for a way to export it from one email address as a file compatible with what the other can import.

Maybe you are looking for

  • J2SE adapter engine monitoring.

    Hi, I have setup GRMG monitoring for a J2SE adapter engine in our landscape. I have set up a HTTP RFC destination in SM59. In the HTTP RFC destination, type H, I have specified the "Target Host" (FQHN) the "Service No." (8200 default J2SE installatio

  • How to handle screen resolution in session method

    how to handle screen resolution in session method  without bdc_insert .

  • Itunes displays two playlists when nano is connected?

    My sons 8 gig nano refuses to sync up and download some albums, video downloads and album art. A message says there are two accounts in itunes which I guess is related to the title of this thread, two separate lists of playlists show in the source co

  • Lookup column only return 201 items from external list

    I have a BCS external list which contains about 700 items. I already set the BCS Throttle limit to 50000 items (default) and 1000000 (max). I can view all 700 items in the external list. I created a regular lookup column in a custom list to lookup th

  • Mac Mini i7 vs iMac i5

    Hello, I need to buy a new Mac and my max budget is $2000. I'm reading a lot about the new mac mini i7 dual-core processors, which are a lot slower than the late 2012 models and also slower than the iMac i5 quad-core model: http://cpuboss.com/cpus/In