Please help me to sort my else if problem

please help me to sort out my if statement. Because, my if statement never ends. It goes on to the next else statement after completing the task of the if statement.
Below is the coding:
if ( Age<25)
price = inputBox.getDouble("Enter Destination Price");
subtotal = (tickets * price);
Total= price-(price *0.3);
studentDiscount = subtotal + Total;
Age = inputBox.getInteger("Enter Age(between 25 and 130):");
if (Age<50)
price = inputBox.getDouble("Enter Destination Price");
subtotal = (tickets * price) ;
Total= price-(price *0.5);
ElderlyDiscount = subtotal + Total;

There is no else. Place an else after the first statement and the second statement will not be executed if the first one is. You then will need to put the Age = statement inside of the next if block.
You could also ues some type of flag to tell the second not to execute....
boolean hasExecuted = false;
if( myStatement == true){
  // do something and set the flag.
  hasExecuted = true;
// next set age statement.
if(myOther statement == true && hasExecuted == false){
  // do something else.
}

Similar Messages

  • HT4061 dears please help me to sort the contact manager problem with iphone 4s. how can i mark to send group sms or to delete few contacts together from all?

    well i am suffreing to editing my contact list. as example how i can mark few contacts together to delete???
    or i want to select few contacts to send same messege like a group messege. but i dont find any such options here!
    regrding music files i cannot rename them or check their indvidual details! so please help me to find out the solutions!!

    I assume you never got a solution. My own painful story is here:
    http://tech.kateva.org/2012/06/icloud-transition-went-as-expected.html
    I've given up on Lion/iCloud. I'll try Mountain Lion.

  • HT202159 I am unable to download and always asking password after entering the password  also asking same question please help  me to sort out  this problem.

    I am unable to download and always asking the password it's ok for the once and it's asking more and no results only repeating the same so I am unable to download please help me to sort out this problem and my request please sort out from your side  or let me guide .

    Thanks Eric for responding.
    I checked and it does not appear in the Applications folder.
    I tried yesterday on an ethernet connection with a download speed of 2 Mbps but, unfortunately the connection died(It happened from the ISP end, which is out of my control) in between after which there was no trace of the download that happened for so long(till the internet connection death). 
    One more serious query which I am unable to understand. If the internet connection, dies in the midst of the download is in progress why is it so that the state does not persist and one has to restart the entire process again. Is there no solution for this?
    I tried so many times and its the same case after some amount of download it vanishes. So many unsuccessful attempts. I am ****** off now. Is it not possible to see Mavericks? Why does different machines of Apple behave differently? Somewhere it goes smoothly and somewhere like my mine. Why did not Apple release a non apple store version? Is this not a bad sign of letting the users struggle when something is being offered for free?
    The reason I asked as whether we can download the .app of Mavericks is that, there are so many applications that I have downloaded web and have installed. All that works fine. Can't we do the same here? You download a copy of Mavericks installer application and upload it for me in Google drive or like online storage places which can be downloaded and used by me? Help me understand.
    Thanks again.

  • Please help me to sort out this issue

    Hi,
    I have two user MAIN_USER and TMP_USER both have DBA,CONNECT,RESOURCE privileges.
    While I am creating the below procedure in MAIN_USER, I am getting the error ‘ORA-00942: table or view does not exist’ in the insert statement line FROM TMP_USER.PROD_MASTER.
    CREATE OR REPLACE PROCEDURE MAST_UPLOAD IS
    BEGIN
    INSERT INTO PROD_MAST
              (SELECT *
              FROM     TMP_USER.PROD_MASTER);
    END;
    Please help me to sort out this issue.
    Thanks,
    Jen.

    If the code works for TMP_USER but not for MAIN_USER, then the privileges are not the same. I'm assuming DBA,CONNECT,RESOURCE are roles. Roles are not the only thing that can be assigned to users. Users can have the same roles, but access to different objects. In this case, it looks like one user has access to the table, and the other doesn't.

  • My MACBOOK PRO NEVER LETS ME OPEN AUTOTRADER AND WHEN I TRY TO OPEN IT GETS FROZEN AND IT FREEZES OTHER WINDOWS AS WELL. Please help me to sort this problem out asap. Thanks

    MY MACBOOK PRO NEVER LETS ME OPEN AUTOTRADER AND WHEN I TRY TO OPEN IT GETS FROZEN AND IT FREEZES OTHER WINDOWS AS WELL. Please help me to sort this problem out asap. Thanks

    To prevent this being accidentally activated in the future go to SystemPreferences>Keyboard>Keyboard Shortcuts>Universal Access and uncheck all the boxes.

  • Hi, I have recently updated my iMac from OS x mountain lion to OS X Mavericks. After that I can't upload any video and some files to my personal email account. Can anyone please help me to sort this problem.

    Hi,
    I have recently updated my iMac from OS x mountain lion to OS X Mavericks.
    After that I can't upload any video and some files to my personal email account.
    I have tried to send a small video clip to the sender as attachment. i have done this before
    with the same video same and same email account. This problem found just after installed the
    OS X Movericks. Can anyone please help me to sort this problem.
    Thanks.
    Roman

    Please follow these directions to delete the Mail "sandbox" folders. In OS X 10.9 there are two sandboxes, while in earlier versions there is only one.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
    Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Repeat with this line:
    ~/Library/Containers/com.apple.MailServiceAgent
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combinationcommand-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • I have 4s iPhone , I download the iOS 7. Now the front receiver microphone is not working , please help me that how to fix the problem.

    I have 4s iPhone , I download the iOS 7. Now the front receiver microphone is not working , please help me that how to fix the problem.

    I live in South Africa, and I had the same problem with my iPhone 4.
    After weeks of frustration and swearing, I was in the process of restoring my phone to a previous iOS. To do that you need to turn the "Find my iPhone" option off, since i turned it off, my problem was solved. No need to repair anything or revert back to old iOS.
    ***** that i cant use Find my iPhone, but atleast i can use my phone.

  • How can i remove my credit card from app store, the none option its not there and i don't Owen  nothing to apple, my last in app purchase was in clash of clans, please help!!! Because of that problem i cant update my apps! Plz help!!!!!

    How can i remove my credit card from app store, the none option its not there and i don't Owen  nothing to apple, my last in app purchase was in clash of clans, please help!!! Because of that problem i cant update my apps! Plz help!!!!!

    You've logged into your account and viewed your purchase history and there aren't any error messages shown (e.g. 'problem with a previous purchase'), and you haven't got any purchases due (e.g. pre-orders and/or subscriptions) : Why can’t I select None when I edit my Apple ID payment information ?

  • Please help me with the digital signature validation problem?

    Please help me with the digital signature validation problem?

    Hi
    Execute the program in the Debuggin mode.
    In the Debugger Window
    Select Breakpoint -> Break point at -> Breakpoint at source code Menu Item and enter the details of the program/include/line no..
    Activate the System Debugger On from the Settings Menu.
    Hope this would help you.
    Murthy
    Edited by: Kalyanam Seetha Rama Murthy on Jul 18, 2008 7:20 AM

  • Since I have Yosemite on my iMac I can't view PDF files in Safari anymore.  It keeps telling me to upgrade my Adobe Reader, but it is the latest version.  Please help?  I don't have this problem on my Macbook that does not have Yosemite installed.

    Since I have Yosemite on my iMac I can't view PDF files in Safari anymore.  It keeps telling me to upgrade my Adobe Reader, but it is the latest version.  Please help?  I don't have this problem on my Macbook that does not have Yosemite installed.

    Back up all data before making any changes. Please take each of the following steps until the problem is resolved.
    Step 1
    If Adobe Reader or Acrobat is installed, and the problem is just that you can't print or save PDF's displayed in Safari, you may be able to do so by moving the cursor to the the bottom edge of the page, somewhere near the middle. A black toolbar should appear under the cursor. Click the printer or disk icon.
    Step 2
    There should be a setting in its preferences of the Adobe application such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected.
    Step 3
    If you get a message such as ""Adobe Reader blocked for this website," then from the Safari menu bar, select
              Safari ▹ Preferences... ▹ Security
    and check the box marked
              Allow Plug-ins
    Then click
              Manage Website Settings...
    and make any required changes to the security settings for the Adobe PDF plugin.
    Step 4
    Triple-click anywhere in the line of text below on this page to select it, the copy the selected text to the Clipboard by pressing the key combination command-C:
    /Library/Internet Plug-ins
    In the Finder, select
              Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens by pressing command-V, then press return.
    From the folder that opens, move to the Trash any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari.
    Step 5
    The "Silverlight" web plugin distributed by Microsoft can interfere with PDF display in Safari, so you may need to remove it, if it's present. The same goes for a plugin called "iGetter," and perhaps others—I don't have a complete list. Don't remove Silverlight if you use the "Netflix" video-streaming service.
    Step 6
    Do as in Step 4 with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari.

  • In my mac i dont create icloud keychain but it is asking password please help me to get out of this problem

    In my mac book pro i don't create icloud keychain. But it is asking password.Please help me to get out of this problem.In OS X Mavericks

    Hi, nportillo,
    The next time you attempt to reach Skype Customer Service, try again using a different web browser and choosing a different path through the various drop-down menu options presented.  Do not choose the obvious - you have already established that path is not working.  Also, look to approve a pop-up dialogue box which would connect you to start an instant message chat with a customer service agent. If you have pop-ups blocked in your browser settings, this will also impede reaching an agent.
    Skype is aware of problems reaching their customer service unit via the website, however people are getting through.  I have flagged your report for follow-up by those to whom I report.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • My 4th generation ipod touch is not turning off when i hold the wake button for few seconds the Voice Control Function Starts Automatically.Please help me to get out of this problem.

    My 4th generation ipod touch is not turning off when i hold the wake button for few seconds the Voice Control Function Starts Automatically.Please help me to get out of this problem.

    Sorry i mistakenly made this question. It was alright. No Problem At ALL

  • Whenever i try to sync apps, tones, music etc, it says me to authorize my computer. But i had already authorized it and had even signed into my account. Can you please help me? I am facing this problems since long. please.

    Hey there.
    Please help me.
    Whenever i try to sync apps, tones, music etc, it says me to authorize my computer. But i had already authorized it and had even signed into my account. Can you please help me? I am facing this problems since long. please.
    It goes like this.
    Whenever i connect my iPhone5, it starts to sync. later when it reaches the 4th stage of 'Tranferring Purchases' it stops and says me to Authorize my computer.
    But i had already authorized it and even signed my apple id.
    Moreover, i have only authorized 1 out of my 5 computers.
    Please help me.
    I have been facing this from long.
    Thank You.

    Hi Rameez,
    Thanks for visiting Apple Support Communities.
    The steps in this article can help if iTunes is asking you to authorize your computer repeatedly:
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
    http://support.apple.com/kb/ts1389
    Best,
    Jeremy

  • Somebody please help me for sorting arrays!!

    Hello.
    I have a problem like this. (http://www.sfusd.edu/schwww/sch697/depts/math/simon/ICTJAVA/WebLessons/APCSL27/APCSL27-1-7.html)
    public class Item implements Comparable
    private int myId;
    private int myInv;
    public Item(int id, int inv)
    myId = id;
    myInv = inv;
    public int getId(){ )
    public int getInv(){ }
    public int compareTo(Object otherObject){ }
    public boolean equals(Object otherObject){ }
    public String toString(){ }
    public class Store
    private Item[] myStore;
    public Store(String fileName) { }
    public void displayStore()
    public String toString(){ }
    public void doSort() { }
    private void quickSort(Item[] list, int first, int last)
    private void loadFile(String inFileName)
    The first line of file50.txt contains the number of id/inventory integer pairs listed on subsequent lines. The idea behind the data type item is the simulation of an item in a store, nearly all of which use a bar code for identification purposes. For every item in a store we keep track of an id value and an inventory amount. So file50.txt looks like this:
    50
    3679 87
    196 60
    17914 12
    18618 64
    2370 65
    etc. (for 45 more lines)
    Each id value in file50.txt will be unique.
    Assignment:
    Write a program that solves the following sequential events:
    loads the data file, file50.txt, as a collection of Item types maintained in a Store object
    sorts the data using quickSort
    prints the data , now in increasing order based on the id field of an Item object
    The printing should add a blank line after every 10 items in the output. Include a line number in the output. For example:
    Id Inv
    1 184 14
    2 196 60
    3 206 31
    4 584 85
    5 768 85
    6 2370 65
    7 3433 5
    8 3679 87
    9 4329 64
    10 5529 11
    11 6265 58
    12 6835 94
    13 6992 76
    14 7282 73
    15 8303 90
    16 9267 68
    etc.
    You will need to complete the getId(), getItem(), compareTo(), equals() and toString() methods for the Item class.
    You will need to complete the Store() constructor, displayStore(), loadFile(), quickSort() and toString() methods for the Store class.
    That's the assigned project.
    this is a side story. I'm a highschooler, and my teacher always hangs out on the internet, teaching nothing. and like this, he just print some problems from the internet and give it to the students. is there a handout about lesson? no. is this always been like this? yeah...
    I have no idea how to right a method called getId(), getInv(), etc...
    would anybody please... please help me?
    p.s.
    the file50.txt is
    on http://www.sfusd.edu/schwww/sch697/depts/math/simon/ICTJAVA/WebLessons/APCSL27/file50.txt
    quicksort is in
    http://www.sum-it.nl/QuickSort.java here.
    somebody please... help me out...

    well you're really going to have to at least do a quick skim of:
    http://java.sun.com/docs/books/tutorial/getStarted/index.html
    And also how to use a browser and browse the API Docs
    especially for: Comparable
    You'll also get flamed for just posting a Homework assignment with no evidence of your own attempts to solve it, OR for not formatting the code with
    [ c o d e ] [ / c o d e ]
    I suppose you get some points if you answer some of the questions?
    Try the easy parts first:
    Complete the methods of the class Item
    Ignore the deliberate Typos in the assignment
    see how you have the class members defined already like:
    private int myId;                         // The guy couldn't be bothered to document his code
    private int myInv;                       // So you will have to.......document itlook at this:
    public int getId() {}As it is the compiler will just say : Missing method body, or declare abstract...
    Your job is to guess what it should do from the 'signature'
    It must return an int and that should be related to Id neh?
    So try things like:
         @return the value of the myId field.
    public int getId()
              return       this.myId;      // return myId would do as well
         Sets the value of myId field
         @param  newId   the new Id to set.
      public void setId( int newId )
           this.myId = newId;             // the old value is replaced with the new
      }do the rest of the simple obvious methods.
    You will get some marks and improve your confidence with simple Java
    Read The API doc on Comparable Interface:
    Decide Carefully how you want to "Order" Objects of type Item.
    In this case this will probably depend first on myId and then subsequently on myInv
    The Comparable interface helps Sorting methods decide qhich object comes first when sorting.
    you will need ssomething like this.
         Implements Comparable - Read the API
    public int compareTo( Object o ) throws ClassCastException, NullPointerException
        if( o == null )
             throw new NullPointerException("Blah blah blah");
       if( !( o instanceof Item ) )
              throw new ClassCastException("Apples and Oranges!");
      Item  item = ( Item ) o;  // Cast o to an Item so it can be checked
      if( this.getId()  < item.getId() )
             return -1;                         // Signal that "this"is less than o
      if ( this.getId() > item.getId() )
            return 1;
      // here both items have the same  myId field
    if( this.getInv() < item .getInv() )
             return -1;
    if( this.getInv() > item.getInv() )
           return 1;
      return 0;                     // they are at the same sort order
    }You use that method like:
      Item a;
      Item b;
      if( a.compareTo( b ) < 0 )
          //blah blah
      }To write the equals method read the API it is similar to compareTo()
    To Read The file : Search on this forum for reading a file line by line.
    Check the API.
    ALso if you have installed Java:
    There are many examples of how to do this in the demo directory
    Even one on QuickSort ---
    So plug away..................

  • A query on Flexfield and valuesets.Please help me in sorting out

    We have created a structure in descriptive flexfield with 4 to 5 segments. Among those one segment has a value set with independent validation type. And all the other segments have value set with dependent validation type on the first segment.
    Now the requirement as per client is as follows:
    If first segment is taken as YES, all the other segments are to be displayed and enabled. If it is NO, then all the segments have to disabled.
    We are able to get it in case of YES but if it is NO, all the segments are being displayed.But we even want them to disable or display off.
    Please help me out in sorting out this issue.

    Hi,
    I don't think thats possible, when you have a valueset in which you are referencing a previous parameter using the $FLEX.<Parameter_name> property, apps automatically sets the dependency. The dependent item is automatically enabled as soon as you enter a value in the dependable field. There is no way to set this dependency conditionally.
    What you can do instead is change the query of your valuesets so that it does not have any records
    i.e $FLEX.<Parameter> = 'YES'
    Regards,
    Vikash
    oraclehrmsways.blogspot.com
    Message was edited by:
    vsethi

Maybe you are looking for