This works for certain entries - why?

im trying to find out the largest number/age but it only works for a certain set of data for some reason.
I tested it with ordinary numbers (no objects created) in a seperate program and it works fine but not this one :-/
ConsoleIO.out.println("\n\n\n\n\nPlease enter the employee number you wish to assign a Mentor to: ");
        int pn = ConsoleIO.in.readInt();
        //get this employees prog lang and age
        Iterator iter = theStaff.iterator();
        while(iter.hasNext() == true)
             Programmer programmer = (Programmer)iter.next();
             if(pn == programmer.getPayrollNumber()) //if the pn == payroll number in arraylist
                  ConsoleIO.out.println("They match\n");
                  thisproglang = programmer.getCertainLang(); //get their prog lang
                  thisage = programmer.getAge(); //and age
        //get other employee ages && proglangs
        iter = theStaff.iterator();
        while(iter.hasNext() == true)
             Programmer programmer2 = (Programmer)iter.next();
             getlang = programmer2.getCertainLang(); //get other employees lang
             getage = programmer2.getAge(); //and age
             if(getage > largeage)
                  largeage = getage; //store the largest age in a variable
        if((thisproglang.equals(getlang)) && (largeage == largeage))
                  ConsoleIO.out.println("Eldest Age: " + largeage + "\nLang: " + getlang + "\n\n");
        }if we type in the payrollnumber of an employee who does java - it shows the eldest employee doing that same language - which is great!
but if we do the same thing except for the employee who does VB - nothing shows but there ARE older employees doing the same language (VB) as them
:-/ - whats going on?

what im trying to do is that if the pn is == (equal
to) a pn number in the arrayList then go on further:
get thispn programming language
(programmer.getCertainLang())
and get the age
THEN I want the same thing to happen for all OTHER
objects (or programmers - same thing) and then compare
to see if the object's age is less than the other
objects ageDon't you want to compare the age ONLY IF the programmer is the same language as the first programmer? If you compare the age to all programmers, you will get the oldest programmer, not the oldest programmer of a specific language. Then, if your oldest programmer is not the specified language, nothing will display.
That's why you need to add a check for the same language before you check to see if the programmer is older.
For example, P1 and P2 are Java programmers. P1 has 5 years of experience, P2 has 10 years. P3 and P4 are VB programmers. P3 has 6 years and P4 has 9 years. So running your code with P1's pn will find that P2 is the oldest programmer and since P2 is a Java programmer, your code will show P2. Running with P3's pn will find that P2 is the oldest programmer, but since P3 is VB and P2 is Java, nothing will display.

Similar Messages

  • Why does the sound only work for certain programs?

    The sound is only working for certain programs on my iPad. Does anyone know why? Any help is appreciated.

    It sounds like you have System Sounds muted. Either the switch on the side, or double tap the home button and swipe to the right, ICON will be on the far left. If the ICON is screen lock related, then it is the switch on the side.

  • Running an old MacBook Pro 2.5ghz core 2 Duo. Battery went chemical meltdown and expanded out of its housing. Removed it and was running off the power cord. This worked for a while. Now it won't start up. Have a Replacement on order. Is there a bigge

    Running an old MacBook Pro 2.5ghz core 2 Duo. Battery went chemical meltdown and expanded out of its housing. Removed it and was running off the power cord. This worked for a while. Now it won't start up. Have a Replacement on order. Is there a bigger issue or does a battery need to be in the compartment to boot up? Appreciate any help. Thanks.

    Working battery needs to be in for the computer to function.

  • Can firefox support "file:///" format to access local files (note 3 fw slashes) this works for IE but not firefox and is the format used in the "afghan war diary" from wikileaks

    can firefox support "file:///" format to access local files (note 3 fw slashes) this works for IE but not firefox and is the format used in the "afghan war diary" from wikileaks

    See http://kb.mozillazine.org/Links_to_local_pages_do_not_work

  • Possible LR CC Instability Fix - This worked for me...

    For those who have upgraded to LR CC and are finding the software to be unstable, are getting gray boxes instead of pictures when filtering images or are finding LR CC is slowing down your computer to a crawl this worked for me....
    1) Go to Pictures/Lightroom/  (or where you have designated your catalog files are stored)
              Rename LR 5 .Irdata file and catalog as .old or any earlier version of LR-if there
              Delete any catalogs and temporary files created by LR CC - yes if you have any work in those files it will be lost, this is the unfortunate trade off to have a working copy of LR CC
    2) Run LR CC as administrator (I haven't tried running it normally, it may work), when if first starts a dialogue box will pop up stating the default catalog cannot be found and ask if you want to create a new one or try to find an existing one - create a new blank default catalog
    That's it.  (Of course I found this after spending 90 minutes waiting for chat help and 2 hours with chat, and uninstalling both LR CC and PS CC2014 in hopes of fixing the issues I was having.)  I've been able to reprocess the images I was working on when I upgraded and converted the catalog...I don't know if this is an upgrade issue or if I did something wrong in the upgrade, but I had a frustrating 3 days of being unable to process a client's family pics and computer crashes.
    Briefly, LR CC would start and open, no hangs or crashes on the splash screen, it would kind of work for a few minutes then the pictures would turn into gray boxes, then the software would just stop working, no error, nothing just unresponsive.  My laptop would slow to a crawl and I would be forced to restart and my laptop would have to be hard booted to be shut down.  If I left LR CC open and my screensaver would start and my laptop would sleep on "waking up" I would have nothing on the screen - no task bar or desktop icons - just a picture and a mouse that moved but did nothing else.
    I hope this helps.
    I wish you luck and virtual chocolate,
    Nonnie

    Thanks for this! I tried doing it a different way and completely ruined my sound all together to the point that there weren't even any audio outputs detected! Fortunately this fix got me back on track and it's working again.

  • Mic doesn't work after upgrade to iOS 7.0.2 ? go to settings privacy microphones and allow access( green button) to apps This worked for me

    Mic doesn't work on iPad 2 after upgrade to ios7.0.2? Go to settings / privacy/ microphones. Then allow access to relevant apps (green button)
    This worked for me on skype, vocal live, mic pro apps

    Can't believe this worked! I had same issue since upgrade, searched web, found this... Hoover the mic for around 15 seconds... It only flaming well worked!  

  • HT2534 what country does this work for? no such caption as none on the paying option

    what country does this work for? no such caption as none on the paying option

    As far as I am aware it works for all countries. You are following the instructions on that page exactly e.g. it's a new account that you are trying to create and you are selecting a free app in the store and clicking on 'create Apple id' when 'buying' it ?

  • What's This Help not working for one entry in each header file

    I have a large RoboHelp project that I have imported into Version 8 from a previous version. Prior to the import into Version 8, all of the What's This Help in the project was working perfectly; now, post-import, I have a problem.
    Firstly, some background information.
    My project contains a large number of individual header (.H) files, one for each dialog within the software. These header files, which have been generated and provided by our developers, contain one entry for each field on the dialog to which the header file relates. The header files are all contained within a \HTML Topics\Fields\ folder (going from the root of my Help project).
    Each header file has a corresponding text (.TXT) file. These text files contain entries that correspond to the entries in the relevant header file. The text files are also contained within the \HTML Topics\Fields\ folder.
    Below is an example of the contents of a header file:
    #define IDH_HIERARCHY_APPEARANCE_HIEARCHY_LIST          16811
    #define IDH_HIERARCHY_APPEARANCE_ADD_APPEARANCE         16812    
    #define IDH_HIERARCHY_APPEARANCE_REMOVE_APPEARANCE      16813
    Below is the contents of the corresponding text file:
    .topic IDH_HIERARCHY_APPEARANCE_ADD_APPEARANCE
    Click this button to add a new row of hierarchical appearance settings to the grid.
    .topic IDH_HIERARCHY_APPEARANCE_HIEARCHY_LIST
    Use this grid to define hierarchy appearance settings. Each row in the grid represents a level of the hierarchy. For example, the appearance settings you define for the first row apply to the top level of hierarchy, the settings you define for the second row apply to the second level, and so on.
    .topic IDH_HIERARCHY_APPEARANCE_REMOVE_APPEARANCE
    Click this button to delete the selected row of hierarchical appearance settings from the grid.
    The What's This Help that was part of the original project still works perfectly. However, after upgrading the project to RoboHelp Version 8, I have had to update the project to reflect changes to the software. As part of this work, I have imported some new header files and updated some existing ones - and edited the corresponding text files accordingly.
    The What's This Help that is covered by the header files that I have imported since the upgrade to RoboHelp Version 8 does not work correctly; in each case, the What's This Help does not work for whichever field appears at the top of the appropriate text file. The position of the entry in the corresponding header file does not make a difference.
    If I manually edit a text file to move a different entry to the top then recompile the Help project, the What's This Help does not work for the field that now appears at the top of the text file - and the What's This Help for the field that used to appear at the top of the text file now works.
    I've tried everything I can think of to fix this, but nothing has worked. It seems as if there is a problem in the way RoboHelp is compiling the header and text files.
    If I use Microsoft HTML Help Workshop to decompile the CHM file, then view the contents of the resulting, decompiled text files, the affected files appear as follows:
    .topic IDH_HIERARCHY_APPEARANCE_ADD_APPEARANCE
    Click this button to add a new row of hierarchical appearance settings to the grid.
    .topic 16811
    Use this grid to define hierarchy appearance settings. Each row in the grid represents a level of the hierarchy. For example, the appearance settings you define for the first row apply to the top level of hierarchy, the settings you define for the second row apply
    to the second level, and so on.
    .topic 16813
    Click this button to delete the selected row of hierarchical appearance settings from the grid.
    Note how the entry at the top - which relates to the What's This Help that doesn't work - appears differently to the other entries which do work. The name of the ID appears after ".topic" rather than the appropriate ID number.
    Any help that anyone can provide me with would be very much appreciated.
    Thank you,
    Mark

    Its working now. We just kept trying to reinstall the tools and restarting indesign. On the 4th time the buttons started working. I can't explain why it finally worked, just that it is working now.

  • I just got an iPhone 4s and facetime doesn't work for certain contacts?  why?

    I know that facetime only works for those contacts that have an iPhone, iPad, iPod, etc....however it doesn't work for some of my contacts that do have those devices....why?
    Many thanks to anyone that can help!
    Heather
    Pasadena, NL, Canada

    using facetime http://support.apple.com/kb/ht4319
    troubleshooting facetime http://support.apple.com/kb/TS3367
    What happens when you try to facetime those contacts?
    Are those contacts on wifi when you try to facetime them.

  • TS1398 why is none of this working for me?

    i tryed everything they told me toand my wifi still wont work for me

    Need more information:
    - Did the iPod connect to this network before?
    - Does the iPod connect to other networks?
    - Do other devices connect to this network?
    - Does the iPod see the network(s)?
    - What happens when you try to connect? Error message?

  • CRM Availability Check not working for certain Item Category

    Hi there,
    I have a situation where for certain order type/item category combinations, the availability check on the same material is not working.
    The check is set up to happen in SAP ECC.
    I have checked the config. under SPRO->CRM->Basic Functions->Availability Check->Availability Check using SAP ECC
    as per many SDN posts on this, and everything looks fine.
    The new item category, which was a copy of an existing one, works (i.e. gives availability) for certain order types, but not others.
    If I create the same order directly in ECC, it works correctly every time.
    I searched the code (from consultants who set it up originally) and can see nothing specific to the order type/ item category.
    I also put a breakpoint on AVAILABILTY_CHECK function module in SAP ECC - it is not being hit, in the case where check is not successful.
    Breakpoints in MV45AFZZ (Sales Order userexit) also not being hit, but they are hit for the Order/item category combination when it works successfully.
    Any suggestions on where else this could be configured would be appreciated!
    thanks,
    David

    Hi David,
    One 'simple' reason for this could be that the copied item category does not have the
    ATP Profile set up in the item category in the IMG. Make sure you have an ATP profile assigned in the area 'ATP Profile' in the item category.
    Please see as well the SCN Wiki link:
    Availability Check CRM-BTX-BF-ATP - CRM - SCN Wiki
    Best regards
    Christophe

  • Re: Mifi and Charging - does this work for charging the iPad?

    I found the following post on here - but it is too old for me to reply directly to it - however, this was a very good post and it worked for me and I would really like to get in touch with mikebob to see if the same thing would work for charging the iPad - his ideas really work. And does he or anyone know how to charge the iPad from batteries?
    thanks a lot
    mikebob
    Contributor
    http://community.vzw.com/t5/user/viewprofilepage/user-id/28840
    Posts: 3
    Registered: 08-25-2009
    Device: mifi 2200
    0
    Re: MiFi and Charging 
    Options
    10-01-2009 07:38 PM
    I finally managed to figure out the proper cabling to get the Verizon Mifi 2200 to charge using a generic USB charger. To recap the problem... The mifi device will only charge when using the supplied micro usb charger, or when connected to a computer USB port using the supplied micro USB cable. When connected to a computer, the device reverts to it's connected data mode, which turns off the wifi ssid broadcast and requires the Verizon access manager application to be launched. Most third party chargers will not work... including most 12V lighter to USB adapters, and most backup battery solutions.
    Here is what is going on... Per the USB specification, Pins 1 and 4 are 5V power and ground respectively. Pins 2 and 3 are data+ and data-. In most chargers, pins two and three are tied via a pullup resistor to the 5V line. If you measure the voltage on 2 and 3 you will see around 3V, equivalent to a logic high state. This has something to do with allowing the device being charged to identify whether it should be in a fast or slow charging mode. More importantly, it is what the Apple iPod expects to see . So, anyone wanting to build generic USB chargers will probably implement this way in order to tap into the single largest device market around. Unfortunately, the mifi does not like the logic high on pins 2 and 3. I haven't yet sorted out why, but when it sees logic high on pins two and three, it refuses to go into charging mode.
    The solution is to use a cable where pins 1 and 4 (5V and GND) are carried straight through. Pins 2 and 3 need to be disconnected from the charging source and shorted together at the Mifi end. If this was a miniUSB instead of a microUSB, it would be what is called a "charge only" cable. I have not found any vendors yet for a charge only microUSB cable so I went ahead and performed surgery on a standard microUSB cable. I took a standard USB cable, cut it and then connected it to a microUSB connector from an old Motorola bluetooth headset charger.   Interestingly, the microUSB connector from the Moto charger  already has pins 2 and 3 shorted together internally so all I had to do was connect 5V and ground and heat shrink tube the whole thing. With this cable I can charge the mifi from any generic USB port, including those on 12V lighter adapters, and rechargeable backup batteries. In addition, I can also connect the Mifi to my laptop to charge while continuing to access the Mifi via wifi. 
    Only word of caution...  You really need to connect the Mifi to your computer using the standard data cable on occasion, say once per month.  The reason is that it is only in this mode that you will receive notifications of S/W updates and/or the need to update your PRL. (preferred roaming list).

    Connect to iTunes on the computer you usually Sync with and “ Check for Updates “...
    If an Update Appears Install it... if not... you are up to date for your particular Device...
    Also see the very end of this Linked page...
    Apple - iOS 6 Whats New

  • Ipod not recognised in ITunes. My solution (try this - worked for me!)

    Hello. i had IPOD 30GB vid for Xmas and have spent 3 days surfing through info trying to find out why itunes did not recognise it!
    I could see it in my computer but not itunes. I tried everything - and I mean EVERYTHING. I reinstalled, rebooted, restored reset etc etc! We had 2 IPODs to install so we knew it couldnt be a total hardware failure as both were doing the same thing.
    Sorry if this is too basic for the techie people but I needed these instructions!
    My problem was that Ipod was recognised as the C drive. Im not sure why this caused such a huge problem but there was a simple solution.
    Following installation of software (inc new version from website) open Itunes. If your IPOD is not showing up in Itunes, (be patient though - it sometimes takes a few minutes) please try this first!
    Open MY COMPUTER and wait until IPOD is showing in there (again - it sometimes takes an inexplicable amount of time - but be patient)
    Click on START icon,
    Right click on MY COMPUTER,
    MANAGE,
    STORAGE
    right click DISK MANAGEMENT
    ALL TASKS
    CHANGE DRIVE LETTER AND PATHS
    Now change the IPOD drive to a letter after L (I used Z for one of the IPOD and X for the other to be on the safe side!) You need to do this for EACH IPOD you want to plug in.
    Now close this down - reboot your machine and start again.
    Open Itunes and be patient. It sometimes takes the system up to 2 or 3 minutes to recognise the IPOD is connected.
    Good Luck!

    I was experiencing the same issue and tried the standard install/re-install steps. I also played around a bit with the msconfig soultion but unfortunatley this didn't work for me.
    On one of my other machines I just finished configuring a Shuffle for my kids. It required me to install a later IPod updater (iPod Updater 2005-11-17). You can find it at http://www.apple.com/ipod/download/
    This seemed to do the trick for me. Goodluck

  • Installing Omnipage Pro X in Snow Leopard - this worked for me

    I was having trouble installing Omnipage Pro X in Snow Leopard - the installer would get near the end and then just quit saying there was an error.  A search on the web revealed many people experienced this, with a few even getting in touch with Nuance who told them Omnipage Pro X is not supported on Snow Leopard.
    I was just about to give up when I had a "last throw of the dice" crazy idea.  I simply copied the entire installer CD across to a desktop folder, just using the Finder to drag and drop all the files from the CD.  I then ran the installer from the desktop copy.
    And it worked!  The installation ran all the way to the end and Omnipage starts up and works perfectly.  I have no idea why this should work, but installing from the CD fails.
    So if all else fails, try this method and see if it works for you!

    I went to the apple store and find that I would have to pay for the QuickTime MPEG-2 Playback Component. You suggested there is a place to download it.
    If we don't have the component in our Utility folder (I don't) that means I must purchase?

  • Additional Fields for ESS-Business Card Not Working for Certain Countries

    Dear Experts,
    We were trying to configure the additional fields to be displayed in Business Card - Overview Screen for all countries. We don't have problem configure and get the new fields display for Malaysia (Molga = 14) but having problem for the field to display for Hong Kong (Molga = 27) and Singapore (Molga - 25).
    The strange thing is I am following the same steps as I configured for Malaysia. Somehow it is not working for Hong Kong and Singapore. As I understand, there is only 1 place to configure in SPRO for this requirement:
    Personnel Management -> Employee Self-Service -> Service-Specific Settings -> Own Data -> Customizing of Personal Information Screens -> Determine Fields for Business Card on Overview Screen
    Please help!

    Hi Siddhart,
    Thank you for the information. We are currently in EhP3 with below Support Components installed.
    Software Component: SAP_HR
    Release: 600
    Level: 60
    Highest Support Package: SAPKE60060
    Software Component: EA-HR
    Release: 603
    Level: 34
    Highest Support Package: SAPK-60334INEAHR
    The note 1159911 provided is within SAPK-60304INEAHR. Thus, I don't think this is the root cause of this inconsistency base on the Highest Support Package installed in our system.
    Anymore hint? Anyone? Please...

Maybe you are looking for