Making a Menu in the command console w/ a While loop

Hello,
I need to design a menu in the command console that allows the user to enter a choice, and after doing so will bring the user back to the original menu of options.
Now I already have set up the menu and I got it working so the user can enter their choice however my questions is, I know I need to use a while loop, but how would I go about doing so in order to have it set up that after a choice is entered it displays the results and then goes back up to the original menu.
I know these new versions of Java do not have a simple GOTO command I can use so I was told a while loop is the way to do it. I know how to set up while loops, I guess what I am asking is what my terminating/repeating condition should be and how to get the program to go back up to the top of the loop thus displaying the menu. Is there any way to maybe use a return false/true and have the loop keep going through only if true? Thanks in advance.

while( condition )
     //Display the menu here
     choice = //enter choice
     switch( choice )
           case value1 : condition = someMethod1();
                                    break;
           case value2 : condition = someMethod2();
                                    break;
           default : // Do something
                             break;
}

Similar Messages

  • How to load the boot menu using the command line , after the configuration change ?

    how to load the boot menu using the command line , after the configuration change ?

    Hi @Bask-48 
    Welcome to the HP Forums!
    It is a terrific place to find answers.
    For you to have the best experience in the HP forum I would like to direct your attention to the HP Forums Guide Learn How to Post and More
    I grasp you are trying to change the boot order.  Here is a link to Configuring the Boot Order in the System BIOS
    that will assist you.
    Good Luck and Happy Holidays!
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

  • HT4710 when i try to go into iphoto i get a message To examine and repair permissions, quit iPhoto. Press the Command and Option keys while you open iPhoto, and select "Examine and repair iPhoto Library file permissions."

    in iphoto i get the shreen with just thr download circle and nothing happens. i click on on edit and get "
    To examine and repair permissions, quit iPhoto. Press the Command and Option keys while you open iPhoto, and select “Examine and repair iPhoto Library file permissions.“
    it still does not work

    Have you tried doing what it says?
    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • How to calculate the ratio between the maximum and minimum peaks of the two waves using two while loops?

    hello everyone,
    i'm rai from indonesia
    I have a final project about pulse oximetriy, I have some problems,
    how to calculate the ratio between the maximum and minimum peaks of the two waves using two while loops to calculate SpO2 ?
    My program image can be seen below predicament ?
    Attachments:
    spo2 akusisi data with filter lpf hpf smoot nilai max min ir merah.vi ‏249 KB

    Hi Rai,
    You should post this into the LabVIEW forum rather than Real-Time since this isn't a Real-Time application. Your post will see more replies in the LabVIEW forum. 
    As far as your question is concerned, you can write the max and min from the respective loops to a local variable to send the data out of the loops to a third loop or just do the calculation in one of the loops. This would be ideal if you're trying to do this while the loop is running. 
    -Jayk
    Applications Engineering
    National Instruments

  • OIM 910: Adding a new menu to the admin console

    Hi,
    I followed the instructions to create a new menugroup/item in the admin console: http://download.oracle.com/docs/cd/E10391_01/doc.910/e10362/custmenu.htm#sthref118, but I see no changes in the console, once redeployed.
    Is there something more in addition to the things described from the manual?
    Env: OIM 910 on Solaris 10, JBOSS
    Thanks in advance.
    Regards.

    Never mind, there was a deployment problem with JBOSS.
    Now everything works, fine, even though the step I followed are slightly different from what the guide describes.
    Thanks a lot.

  • How to use return value from TestComplete ( using COM) as a variable in the conditional statement (e.g. while loop) in TestStand

    Hi,
    I have setup a COM interface for TestStand(TS) to run certain scripts in TestComplete (TC).  Normally, when TestComplete finishes executing the script, it returns a 0 or 1 to denote pass/fail in the TestStand step (e.g String value test step).  This worked fine.
    However, now I need TestComplete to return a vaule( e.g 32) to TS, and TS need to evalue this value in a while statement. So if TC return value is 32, I'd have some statement in TS ike :                                                                                                 
    While (return value != 30)
    Do something..
    Thanks,
    Solved!
    Go to Solution.

    There are a hundred ways to implement what you are asking.  The hard part is deciding which one would be the best for you.
    What adapter are you using to communicate with TestComplete?  ActiveX?  Is TestComplete running asynchronously (in parallel)?  If so then how is the data getting back to TestStand?
    So here are some options:
    1. You can use the While Step type.  It's in the Flow Control folder in your Step Types pallette.  Look in your examples under UsingFlowControlSteps.seq in the SequenceFlow
    2. You can loop on a step and have the termination for the loop be (return value == 30).  Look in the Step Properties under Looping.  Also in the TestStand help
    3. You could do Post Actions based on a condition and have it jump to another step.  Read about it in the TestStand Reference Manual.
    4. You could use a GoTo step.  I don't really recommend this one.  It makes code hard to maintain.  Also an example in SequenceFlow called gotobeep.seq.
    Hopefully this gets you thinking.  Let me know if you have specific questions about any of these methods.
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How to put the break at the first place of execution While Loop

    Hello everybody,
    I have a problem with a while loop.
    I made the interface of a tic-tac-toe game with labview.
    my problem is that after the computer has won or there is a draw, that the board has to be updated, which i do by shift register.
    My problem is now though, that there isn't a break after i updated the board. I have to click one more time on the board(and execute the whole VI) before the break sets in.
    so my question is, how can i put the break in a way that the condition is checked everytime BEFORE the VI runs?
    Thank you very much

    The correct way is probably to use a state machine architecture. Simply enter the idle state when the game is over.
    LabVIEW Champion . Do more with less code and in less time .

  • Question for the math lovers!  Using while loop and exponents

    Hi there Java geniuses! ; ) A little question here that has been perplexing me for the past few days. I'm trying to create a class that contains a single static method as follows:
    public static double exp(double a)
    It's supposed to work to calculate an "exp" value much like the Math.exp method of the Math class. Essentially, I need to keep calculating approximations of "exp" until a certain condition is met. This condition is specified in a while loop. Following is what I've written so far. But I can't seem to get the thing to work properly. Any suggestions/ advice would be greatly appreciated! Thanks.
    A class that computes the "exp" for a user-defined
    value.
    public class MyMath
    public static double exp(double x)
    double dbloldGuess;
    double dblnewGuess = 1 + x; // First value for newGuess
    double dblcounter = 1;
    do
    dblcounter++; // increments counter
    dbloldGuess = dblnewGuess;
    dblnewGuess = dbloldGuess + ((x ** dblcounter) / counter);
    while (Math.abs((newGuess - oldGuess) / newGuess) > 1e-15);
    return x;
    }

    ** wasn't an operator in C when I last checked...
    Anyway here's my lousy attempt:public static double exp(double a) {
            double guess = 1;
            int N = 18;
            while (N --> 1) guess = 1 + a/N * guess;
            return guess;
    }When called with 1.0 as argument gives the value equal to the constant Math.E, so is "probably" ok for arguments 0.0 -- 1.0. I wont guarantee anything else because this method is pretty pathological when it comes to loss of precision due to rounding, even if you increase N.

  • How can I use the symbol "or" in a while loop

    I have an error in the attach Vi. Do you know how I can fix it? Thanks
    Attachments:
    while_ctrl.vi ‏33 KB

    No. When you compare two numbers, you get a number out. Look at and read the function help. Try this. The function I used is Elapsed Time. Somehow the label got mangled when I pasted it into paint.
    Message Edited by Dennis Knutson on 03-20-200602:35 PM
    Attachments:
    Elapsed Time.JPG ‏13 KB

  • Problem with command console????

    I am using Windows XP pro.
    When using the command console, usually if you type:
    cd c:\java
    the console prompt should be in that directory i.e. it should read
    C:\Java>
    However, when I type this, it does not do anything, other commands such as 'dir' work fine, but I cannot get the prompt to change directory by typing cd 'dir name'.
    Does anyone know what the problem is?
    Manny thanks

    Use:
    C:
    cd java
    or:
    cd C:\Java
    C:

  • MacBook Pro: Where is the Command button?

    where is the command button? i need to hold the command and option button while connecting my ipod to itunes for something.

    It's the key with a cloverleaf and/or Apple symbol, depending on the keyboard you're using.
    http://en.wikipedia.org/wiki/Command_key

  • Focus should remain at the command link

    I have Command links and I want to do everythibg(moving from one link to other and want to perform operation) using "tab" key instead of selecting it through mouse.
    when ever user selects the command link,one popup will be displayed
    ,under the popup,a dialog window of type "ok Cancel" was taken,in the dialog window one input text was taken.
    The Problem is without entering the text in the input text and clicking on ok button using tab,remains the focus of the cursor on the command link and
    also while clicking on the cancel button the cursor position remains at the command link only but
    when ever user enters the text in the input text and
    selects the ok button using tab,the cursor focus is moving to top of the page,not remains at the command link.This problem is not taking place while
    using mouse.
    Can anyone please tell me how to the remain the focus at the command link.
    I am using jdev 11.1.2.3

    Okay, that makes sense. However, I modified my code to actually move the lead, and it still didn't work. Curious, I added a pop up window to the code, and I found out that it doesn't get called. The tab key still doesn't do anything. I miss KeyListeners already :(
    Can you spot anything wrong with how I'm doing this?
    InputMap im = _table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke tabKey = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
    Action tabAction = new AbstractAction(){
                   public void actionPerformed(ActionEvent e){
                        int leadColumn = _table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
                        leadColumn ++;
                        if(leadColumn > 4){
                             leadColumn = 4;;
                        _table.getColumnModel().getSelectionModel().setLeadSelectionIndex(leadColumn);
                        JOptionPane.showMessageDialog(null, "L: " + leadColumn);  //this doesn't happen either
    im.put(tabKey, tabAction);

  • Why the execution time increases with a while loop, but not with "Run continuously" ?

    Hi all,
    I have a serious time problem that I don't know how to solve because I don't know exactly where it comes from.
    I command two RF switches via a DAQ card (NI USB-6008). Only one position at the same time can be selected on each switch. Basically, the VI created for this functionnality (by a co-worker) resets all the DAQ outputs, and then activates the desired ones. It has three inputs, two simp0le string controls, and an array of cluster, which contains the list of all the outputs and some informations to know what is connected (specific to my application).
    I use this VI in a complex application, and I get some problems with the execution time, which increased each time I callled the VI, so I made a test VI (TimeTesting.vi) to figure out where the problem came from. In this special VI I record the execution time in a csv file to analyse then with excel.
    After several tests, I found that if I run this test VI with the while loop, the execution time increases at each cycle, but if I remove the while loop and use the "Run continuously" funtionnality, the execution time remains the same. In my top level application I have while loops and events, and so the execution time increases too.
    Could someone explain me why the execution time increases, and how can I avoid that? I attached my test VI and the necessary subVIs, as well as a picture of a graph which shows the execution time with a while loop and with the "run continuously".
    Thanks a lot for your help!
    Solved!
    Go to Solution.
    Attachments:
    TimeTesting.zip ‏70 KB
    Graph.PNG ‏20 KB

    jul7290 wrote:
    Thank you very much for your help! I added the "Clear task" vi and now it works properly.
    If you are still using the RUn Continuously you should stop. That is meant strictly for debugging. In fact, I can't even tell you the last time I ever used it. If you want your code to repeat you should use loops and control the behavior of the code.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How do you plot multiple curves on the same graph when using a while loop?

    I am writing a program that will plot the IV Output chracterisitcs curves for a MOSFET transistor. I have two sweep variables Vg and Vd. For each Vg valve selected, Vd is swept from its start to stop voltage creating a graph for that Vg valve. Both of the sweeps are done using while loops. Ideally I would like to display all of the Vg plots on the same graph while having the ability to do real-time graphing. Can anyone help me figure this problem out? I have attached my program. Thanks!!
    Tammy
    Attachments:
    outputfin2.vi ‏165 KB

    Hi Tammy & Tica T,
    As far as I see it - this thread is a very bad version of already existing bad version......
    http://forums.ni.com/ni/board/message?board.id=170&message.id=127857
    I expected, that an Applications Engineer from NI knows something about  a Transistor and how an Output characteristic looks like !!  Take a look to a typical Transistor Datasheet ( e.g. n-channel MOSFET) - you will see, that there is no relation of ID vs Time like in your example ( values vs time )  but  IDrain vs VDrain at different VGate's ( no relation to Mr. Bill Gates ).
    Find attached a vi, that in general does what you need - drawing of  curves vs x-axis (XY-graph in use)  - in test_sweep.zip.  And that you geet an impression, how it might be done ...... dynamic Output characteristic of a Transistor with Standard Equipment of a Lab ( Scope + Generator + Power Supply ) find in addition a Frontpanel - picture. One of the interesting points here is - the self-heating effect; visible on ch3 of scope - 5µs Pulse is already a very long time...... This measurement was done in order to compare with our own Transistors......... 
    Hope this helps a little bit to understand, what we are talking about.
    Regards
    Werner
    Attachments:
    test_sweep.zip ‏358 KB
    dynamic Transistor char.png ‏65 KB

  • How to structure a control and its display in the same while loop and same display panel (instead of display panel and a seperate parameter-setting panel )

    As you can see, I need to adjust the Target position to certain value (like 1068.88), the actual position is showing 1066.99.  What kind of flow control structure will achive this goal?
    Notice the Labview example "Vibration analysis"  may shed some light on this issue.  Will someone give out a simpler code to show how it works?
    Attachments:
    Spectrometer Control V3.0.vi ‏113 KB

    lightblue,
    Just to make sure we are on the same page, you would like to set the position, then monitor it.  Is that correct?  In that case, you might have a few options.  You could have a sequence that would set the position, and then a while loop that would monitor the position, however this wouldn't allow you to update anything else.  The other option would be to use parallel while loops, which would be similar to the parallel sequence structure you have below.  The only issue with this would be that if you are calling the driver from both loops, you could run into errors.  The Vibration Analysis.vi takes the setpoint, then calculates the actual available position, so it won't serve as a very good example, code-wise. 
    Hope this helps!
    Andy F.
    National Instruments

Maybe you are looking for

  • More exceptions

    i need to catch the exceptions if the input is not a number, not an integer, and out of range. I am not sure how to determine between the 1st 2 exceptions. i know i should use parseDouble and parseInt but how do both of these fit in? here is what i h

  • Please add "open in new tab" in right click context manual for pages in tabs

    tab bar pages like google or yahoo. When I want a duplicate page , pointing to individual tab & using right click does not have "Open in a new Tab"! browser like orcabrowser and a few other browser using firefox engine seems to be able to provide thi

  • I have some applications that haven't finished updating and I can't open nor delete them?

    I have some applications that haven't finished updating and I can't open nor delete them?

  • How to integrate different creator projects

    We have 3 diff creators installed on 3 diff machines we are developing diff modules on these 3 creators. Now we want to integrate all the modules in 1 project(my creator). we cant move classes from 1 project to another as it is time consuming (less R

  • Sharing files between Leopard and Panther

    I have two iMac's running Panther (10.3.9) that are networked wirelessly and living happy together. Today I wanted to add a new iMac that his running Leopard into the network that is also wireless. I have no problem accessing the internet using the w