Remove object and doesnt update salary

i was testing my app today and found out that for some reason, when i unattach and object from each other - it doesnt update the mentor's salary for some reason :-/
it kinda does but not properly
for every java programmer the salary increased by 5% - thats done. so lets say we start with basic salary of 1000 - 10% of it is 1100
it does that fine
then if a mentor has a mentee - 5% increase PER mentee
so if we have 1 mentee to a mentor it should be 1155
if we remove the mentee from the mentor - the mentors salary should be 1100
but it doesnt do it :-/
must be invalid calcs in my program but dont know what
if we add a mentee to a mentor - mentors salary is 1270
then if we remove the mentee from mentor - the mentors salary is 1210
any ideas?
//this is in the programmer class:
    public int    getMonthlySalary() {   
        int monthlysalary = super.getMonthlySalary();
        int bonus = 0;
        if(theLanguage.equals("Java") == true || theLanguage.equals("java") == true)
             bonus = (int) (monthlysalary * 0.1);
        return monthlysalary + bonus;
    }  this is in the mentor class:
        int monthlySalary = super.getMonthlySalary();
        int bonus = 0;
        int numberOfProgrammers = theMentorings.size();
        bonus = (int) (numberOfProgrammers * 0.05 * monthlySalary);
        return monthlySalary + bonus;and the toString method in the mentor class:
        int thesalary = 0;
        String thesalfin = null;
        String menteesdetails = "";
        //ConsoleIO.out.println("\nMentees: \t");
        Iterator mentees = theMentorings.iterator();
        while(mentees.hasNext() == true)
             Programmer mentee = (Programmer)mentees.next();             
            // increase the salary
            thesalary = thesalary + this.getMonthlySalary();
            menteesdetails = menteesdetails + "\n" + mentee.toString() + "\n\n";
        thesalfin = new Integer (thesalary).toString();
        return "<----------------------------------->\n" + super.toString() + "\n\n\tMentors Mentee's:\n<=>\n" + menteesdetails + "\n<=>\n<----------------------------------->\n\n"; //+ "\n\nThe MENTOR monthly salary: " + thesalfin + "\n";

i have done that but found where the problem is
when adding mentee and mentor method in Softwarehouse - if the programmer is NOT an instanceof Mentor - it creates the mentor object, removes programmer and adds the mentor object in the softwarehouse - if they obviously do java it increases the salary AGAIN by 10% - thats the problem it does it twice :(
     anotherage = mentorage;
     foundMentor = true;     
mentorname = prog.getName();
mentorproglang = prog.getCertainLang();
mentorpn = prog.getPayrollNumber();
mentorage = prog.getAge();
mentoryob = year - mentorage;
mentorsal = prog.getMonthlySalary();     
if(prog instanceof Mentor)
((Mentor)prog).addMentee(mentee);
else
createit = true;
mentorjavalang = prog.getCertainLang();
mentortemp = prog;
if(createit == true)
theStaff.remove(mentortemp);
Mentor mentormain = new Mentor(mentorname, mentorpn, mentorsal, mentoryob, mentorjavalang);               
theStaff.add(mentormain);
mentormain.addMentee(mentee);               
}

Similar Messages

  • Code for Custom Business Object and Adding/Updating Data

    Hi,
    I would like to update/insert data thru Custom Business Object to sql Server.Pls let me know is it possible in MSA.If yes I would appreciate if you can share the code/Process in this forum.
    Thanks and Regds
    Harish

    Harish
    Depending on what data you update you need to do the following:
    If updating SAP tables or customer tables which are an extension of a SAP object like business partner, material, activity or similar:
    1. Create the extension of the data object via the easy enhancement workbench (EEWB). This will also create mapping functionality from MSA to CRM Server and extend the BDocs.
    2. Go to the BDoc modeler. Find the sBDoc for data exchange (type Write BDoc), that contains your object and check whether the new segment is there.
    3. In the Mobile Application Studio (MAS) you can now create a custom business object related to the standard sBDoc mentioned in 2 which is mapped to the new segment. This way the data exchange happens together with the main object
    4. Drag & drop the fields of the new BO to a new tile, and link that tile to the existing main object in the UI via the appropriate relation.
    If you would create a new business object / BDoc for a set of attributes belonging to a main object and not use an extension of the existing BDoc then the data would get its own flow and when replicating it would not come together with the main data. This can lead to data inconsistencies and in surplus effort administrating this data.
    If you have your own objects not related to a SAP object, you can do it the following way:
    1. Create your own table(s)
    2. Create a Write sBDoc on the table(s)
    3. Create BO's on each BDoc segment / table
    4. (as above)
    Hope this helps,
    Kai

  • I rate a song but it doesnt show in itunes and doesnt update Smart Playlist

    I have a problem i cant figure out. I have a smart playlist on my iphone for songs rated 5 stars. When i rate a song 5 stars on my iphone it doesn't update the playlist with it. Whats weird is the very same playlist does update on my wifes iphone without going into itunes to sync. She runs 3.0 nd im on 3.1.
    aNy ideas why the rating doesnt update when i do it on the phone and not in itunes?

    Hello there, Double-d2014.
    The following Knowledge Base article provides the steps for downloading your purchase to your iPhone:
    Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/ht2519
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Smart objects and auto update

    I have a stack of screenshots to maintain, where what changes most often is the release information: so, I've made a separate .psd with the header and used File > Place to add it as a smart object. What I'm not having any luck with, is changing that single .psd file and seeing the update ripple through to all the screenshots. Tell me what I'm missing!

    Maybe this is of interest to you.
    http://www.ps-scripts.com/bb/viewtopic.php?f=27&t=3045&sid=70f368dca9bfd96f3c974ee11b798f9 7

  • Command Line - Remove user and group updates

    I am remote at the moment and not able to access the GUI on a number of OS X server boxes. How do I remove a user and the user from group via the command line.
    Thanks

    I am remote at the moment and not able to access the GUI on a number of OS X server boxes. How do I remove a user and the user from group via the command line.
    Thanks

  • HT5244 Flashback Removal Tool and Software update is not working!

    My software is up to date but the virus is still detected on my computer, what should I do? The  flashfake removal tool from Kapersky(I may have spelled it wrong) detects a virus but when I click on it to remove it, nothing happens.

    Try using Apple's tool released today: Flashback malware removal tool 1.0.
    Helpful Links Regarding Flashback Trojan
    A link to a great User Tip about the trojan: Flashback Trojan User Tip
    A related link in the tip to a checker: Malware Checker Dowload Link
    Another excellent reference on malware: Mac Malware Guide
    A Google search can reveal a variety of alternatives on how the remove the trojan should your computer get infected. This can get you started.
    Checking for and removing the "Flashback" trojan
    Kaspersky Flashback Trojan Site:Flashback Trojan Detection and Removal
    F-Secure Tool: Flashback Removal Tool
    Also see Apple's article About Flashback malware.

  • App Kindle doesnt update

    I am trying to update Kindle app but it is idle and doesnt update, what can I do?, I am trying to update Kindle app but it is idle and doesnt update, what can I do?

    by update and fixes i mean gingerbread 2.3 update with fixes.

  • Conflict between Client object model and Item Updated Event Receiver in sharepoint 2010

    Hello All,
    As per my requirement I have a two custom list.
    Agent Details
    Port Name
    Agent Details contains Agent code, Port Name,  email, address and phone of Agent. Its possible that one Agent Code is connected with multiple Port Name.
    Basically what I am doing is I am getting port name connected with Agent code, using jquery and bind those values with check box(using javascript created dynamically) and bind all with Div tag.
    Now when my custom edit form of Agent list open up it shows me different port name binding with checkbox group.
    when user select the check box and click confirm button my clicent object model script will run and add this selected value into Port Name list. 
    After confirm one more button named Save will enable asking user to edit the email, phone or address value and when I click on save my Item updated event fires which update the values of the selected port name(These port name I am getting from port
    name list) to Agent Details custom list.
    Now when I am trying to update the values my event receiver fires or some times it got stuck(not firing). So could you please help me the possible alternative for this requirements.
    Can we user the Ecma Script(Client object model to preserve the value of selectec port) and Item updated event receiver on the same time?
    Is anything am doing wrong then please guide me.

    Hi,
    As I understand, when you updated values in the agent details list the Item updated event receiver got stuck sometimes.
    The item update event receiver will fire after the item has been saved, and the client object model script or the Ecma Script runs before the item is saved, so there is no conflict between the client object model script and item update event receiver.
    You could find out the reason about the item update event receiver gets stuck by debugging the event receiver.
    When you want to debug your event receivers, you have to attach to OWSTIMER.EXE and wait till they are executed. You can control this behavior using the Synchronization attribute. Also, if you’re looking for an easy way to debug an event receiver without
    having to manually attach a debugger to your code, you can use the System.Diagnostics.Debugger.Launch() method.
    The articles below are about how to debug in the event receiver in SharePoint 2010.
    http://sharepoint-kings.blogspot.jp/2013/02/debugging-event-receivers-in-sharepoint.html
    http://chakkaradeep.com/index.php/event-receivers-in-sharepoint-2010/
    http://sharesaint.com/?p=77
    Best regards,
    Sara Fan
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • TS5376 For about 4 months now I have been getting an Apple I-Tunes update message but when I try to install it, the program stops and refuses to install it saying I need to go to tools and manually install. the support page says:1. Remove iTunes and relat

    Dear Windows support personel,
         As part of my message reads above; I keep getting an i-tunes update message and when I click on the OK to download it, I get an error message saying there was a problem and I need to go to Tools>manual download.  Well, I don't know how to do that even though I gave it my best try. I went to the support sight and it had the following message;
    1. Remove iTunes and related components from the Control Panel
    Use the Control Panel to uninstall iTunes and related software components in the following order. Then, restart your computer:
    iTunes
    Apple Software Update
    Apple Mobile Device Support
    Bonjour
    Apple Application Support (iTunes 9 or later)
    Important: Uninstalling these components in a different order, or  only uninstalling some of these components, may have unintended affects.
    If you encounter an error while uninstalling, try repairing the affected component:
    I don't know if I should do that since I'm not PC savey. Could you help me by doing the work on my pc for me? I'd be most apprieciative if you'd help me in this manner.
    Sincerely,
    Christine Bocker
    <Email Edited by Host>

    Let's first try updating using an installer file downloaded from the Apple Website:
    http://www.apple.com/itunes/download/

  • My iphone 4 is dead after I updated to ios 6.1.3 it doesnt turn on and doesnt respond to itunes also. Visited Apptronix service desk but they say there is nothing they can do about it, and they have charged INR 10640 for a new one. Is there anybody same..

    My iphone 4 is dead after I updated to ios 6.1.3 it doesnt turn on and doesnt respond to itunes also. Visited Apptronix service desk but they say there is nothing they can do about it, and they have charged INR 10640 for a new one. Is there anybody with similar problem....

    Hm... Try this----> http://support.apple.com/kb/ht1808 or http://osxdaily.com/2010/12/04/ipad-dfu-mode/

  • I updated Firefox and now it will not open at all. The hourglass shows that it's working but then nothing. I went to add/remove and removed mozilla and reinstalled it and still the same thing. It worked fine before I updated.

    I updated Firefox and now it will not open at all. The hourglass shows that it's working but then nothing. I went to add/remove and removed mozilla and reinstalled it and still the same thing. It worked fine before I updated. Now I can't even remove the program at all. Why is this happening?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    Create a new profile as a test to check if your current profile is causing the problems.
    See "Basic Troubleshooting: Make a new profile":
    *https://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins" in case there are still problems.
    If that new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    See:
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • I tried to update itunes but keep getting these messages..The older version of Bonjour cannot be removed..and the older version of Apple software update cannot be removed..it won't work. How do i fix this?

    I tried to update itunes and keep getting these messages..the older version of Bonjour cannot be removed..and The older version of Apple software update cannot be removed. How do i fix this does anyone know?  I recently got an IPhone 4 and don't understand all this stuff yet. Thanks

    Hi Kathy,
    Welcome to Apple Support Communities.
    See this article for some steps to troubleshoot your iTunes installation:
    Trouble installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    Cheers,
    Jeremy

  • My ipod touch(4th gen) just recently had the iOS 5 update.bu for some reason about 80% of my music collection appears with no album artwork and doesnt play any songs.basically it has my music on their but wont let me access it? please help!

    My ipod touch(4th gen) just recently had the iOS 5 update.bu for some reason about 80% of my music collection appears with no album artwork and doesnt play any songs.basically it has my music on their but wont let me access it? please help!

    i have the same problem but i have ios 5.01. how do you unsync? please help, thanks

  • Hi, I've a 3GS and iPad (on 5.1.1) and Macbook (10.6.8) all connected to iCal on iCloud, but when I change an event on phone it doesnt update on iCloud/other devices - any ideas?

    Hi,
    I've an iPhone 3GS and iPad '1' (both on IOS 5.1.1) and Macbook (on 10.6.8) - all connect happily to my iCloud iCal (using the iCal app for iPhone/iPad and Firefox browser for access to my iCloud).
    But ... when I change an event (add/delete) on my iPhone it doesnt update on the iCal on my iCloud, therefore neither on iCal on my iPad!
    Yet if I change anything on my iCal iPad / iCal iCloud it updates/refreshes on the iPhone fine?
    So - it clearly recognises/refreshes any updates but can't update the iCloud!
    Any ideas?
    Don

    If you're also having problems changing the account on your iOS devices, go to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iDevice, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll.  When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • Updating User field with ListItemFormUpdateValue object and ValidateUpdateListItem for a file metadata

    Hi Every body,
    Please this is very argent I'm searching for this problem sine a week with no success
    how can I update a user field (single and multi) using ListItemFormUpdateValue object and ValidateUpdateListItem method
    Thanks in Advance
    khatib7

    Hi,
    Seems there are already replies in your another similar thread about this issue:
    https://social.technet.microsoft.com/Forums/en-US/5e67dc3d-c808-49ee-9aab-383a5cea5bce/sharepoint-angulr-rest-api-update-file-item-userd-field-property?forum=sharepointdevelopment
    Please check whether they are helpful to you.
    Thanks 
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for