Need help w/ for loop, a do loop, and a do-while loop.

Hello I have been trying to write a program that uses a for, do, and a do-while loop, but I am having trouble. I need the program that will prompt the user to enter two numbers. The first number must be less than the second number. I need to use a "for loop", a "do loop", and a "do-while loop" to display the odd numbers between the first number and the second number. For example, if the user entered 1 and 8, the program would display 3,5,7 three different times (one for each of the loops). Please help if you can. Thanks.

boolean2009 wrote:
Thank all of you all for responding.Youre welcome.
Yes this is my homework, but my major does not even involve java i just have to take the class.Not our problem.
And yes we are suppose to have all three in one program I do not know why,So you can learn all three types of loops (there is also an enhanced for loop to learn later on).
but I just do not understand programming nor do i really want to.Once again not our problem.
If anybody could help it would be much appreciated. thanks.Yes, a lot of people are willing to help you. No, none of them will do it for you. What you need to do is attempt the code and when you get stuck, post your code using the code button, include error messages, indicate which lines in your code genereate those error messages and ask specific questions.

Similar Messages

  • How to make a button to stop and run a while loop?

    Hi all,
    I am a beginner in the Labview. I did a program that contains a while loop, its stop condition is connected to button. I selected “switch when pressed” to be the operation of this button. Our teacher asked us to make this button stops the loop if it is pressed and its name is converted to run instead of stop. And if it is pressed then again it starts the loop from the point it stopped in.
    Can anybody help me, please?

    First, please use a smaller font when composing your messages.
    You will need two while loops.  An inner loop which has its stop terminal attached to the stop button.  Put that in the False case of a case structure.  Wire a local variable of that stop button to the case selector of the case structure.  Put the case selector inside another while loop which is the one that keeps the program running no matter what the state of the original Stop button.  You will need a master stop button to stop the outer loop when you are ready to end the whole program.  Don't forget to put small millisecond waits in each of the loops so that the loops don't eat up all the CPU resources.
    For that stop button, you could rename the True title to Run, so that when it is pressed to stop the inner loop, the button will show the word Run.  Pressing it again pops it back out, allows the false case to execute and the innermost while loop to run.
    You could also change the words on the buttons by using property nodes.

  • When PC System timing hits 0000hrs Loops back to start and runs again using Loop function?

    When PC System timing hits 0000hrs Loops back to start and runs again using Loop function?

    It's all described in the help for it. Vista version:
    Attachments:
    Task Scheduler.png ‏61 KB

  • I need help, i am having a brain fart and i can' think. Dice rolling Game

    here is what i am supposed to do:
    write an app to simulate the rolling to 2 Player (Player and Computer)
    Show each rolling in Map size 50 channel
    Just like this: Player play frist
    1 2 3 4 5 6 7 8 9 10
    11 12 13 14 15 16 17 18 19 20
    21 22 23 24 25 26 27 28 29 30
    31 32 33 34 35 36 37 38 39 40
    41 42 43 44 45 46 47 48 49 50
    [0] ... Press any key to rolling
    You got : 6
    Your position : 6
    1 2 3 4 5 [P] 7 8 9 10
    11 12 13 14 15 16 17 18 19 20
    21 22 23 24 25 26 27 28 29 30
    31 32 33 34 35 36 37 38 39 40
    41 42 43 44 45 46 47 48 49 50
    [0] ... Computer is rolling
    Computer got :2
    Computer position: 2
    1 [C] 3 4 5 6 7 8 9 10
    11 12 13 14 15 16 17 18 19 20
    21 22 23 24 25 26 27 28 29 30
    31 32 33 34 35 36 37 38 39 40
    41 42 43 44 45 46 47 48 49 50
    [0]... Press any key to rolling
    You got: 6
    Your position : 12
    1 [C] 3 4 5 6 7 8 9 10
    11 [P] 13 14 15 16 17 18 19 20
    21 22 23 24 25 26 27 28 29 30
    31 32 33 34 35 36 37 38 39 40
    41 42 43 44 45 46 47 48 49 50
    [0].... Computer is rolling
    Rolling until someone got 50
    Show Game over
    That is about it. I need help, i am having a brain fart and i can' think. it is done in java in console, no graphics or nuthin.
    thanks

    That is about it. I need help, i am having a brain
    fart and i can' think. it is done in java in console,
    no graphics or nuthin.So to fill in your question:
    "Please someone do my homework for me ? "
    Or do you have an actual question ?

  • Need help re-synching iPods with new computer and getting iTunes to...

    Need help re-synching iPods with new computer and getting iTunes to recognize our iPods (it doesn't even recognize them when they're plugged in).
    Hubby wiped my harddrive for me, so now I need to get everything back in proper places. I'm using windows XP and installed iTunes once again (I believe it's version 8). I also installed all of my iTunes songs. Now I need to know where to go from here. We have 3 iPods and I need to get them all synched once again. I know how to create different libraries for each of us, but I can't figure out how to get our songs back into our iTunes libraries. When I open iTunes and plug in an iPod, iTunes doesn't even show that an iPod is plugged in.
    What do I do now to get each of our iPods synched with our own libraries?
    TIA
    Brandy

    Thanks Zevoneer. The "Restart ipod service" worked and itunes is now recognizing my ipod! Hooray!
    Okay, now how do I synch all of our ipods with our individual libraries (I don't want all of my kids' songs and vice versa)? We each have hundreds of songs on our ipods that we don't want to lose.
    Thanks again!

  • Re: Beginner needs help using a array of class objects, and quick

    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ? In html, I assume. How did you generate the html code of your three classes ? By help of your IDE ? NetBeans ? References ?
    I already posted my question with six source code classes ... in text mode --> Awful : See "Polymorphism did you say ?"
    Is there a way to discard and replace a post (with html source code) in the Sun forum ?
    Thanks for your help.
    Chavada

    chavada wrote:
    Dear Cynthiaw,
    I just read your Beginner needs help using a array of class objects, and quick of Dec 7, 2006 9:25 PM . I really like your nice example.You think she's still around almost a year later?
    I also want to put a question on the forum and display the source code of my classe in a pretty way as you did : with colors, indentation, ... But how ?Just use [code] and [/code] around it, or use the CODE button
    [code]
    public class Foo() {
      * This is the bar method
      public void bar() {
        // do stuff
    }[/code]

  • Need a link for PS CS6 Extended Student and Teach

    Need a link for PS CS6 Extended Student and Teacher's Edition.  My copy fried on my laptop and I need to re-install or do a repair install.  The adobe site is trying to force me into this cloud product world.  The links here:
    http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    Are broken --- I won the product - just need install files again without being assimilated into a whole new cloud platform.  Why break the old links?  I  have had this about 20 months....

    Manning777 you should be able to download the software from the page you referenced.  I would recommend trying a different web browser or perhaps checking the security settings on your browser.

  • I need help restoring the ability to view Youtube and all videos of my 4 year old MacBook after receiviving a meaage the the Adobe ineeds to be updated?  Thanks.ng

    I need help restoring the ability to view Youtube and all videos of my 4 year old MacBook after receiving a message the the Adobe ineeds to be updated?  Thanks.

    Did you upgrade whatever product from Adobe was out of date yet?

  • I need help! I have the iphone 5 and I want to buy the whastsaap, but it turns out I get to put the answers up and answer the questions but I do not remember. Someone could help me? Help! Thank you!

    I need help! I have the iphone 5 and I want to buy the whastsaap, but it turns out I get to put the answers up and answer the questions but I do not remember. Someone could help me? Help! Thank you!

    Security questions:
    https://discussions.apple.com/thread/4533485?tstart=0

  • Hello need help I download a game from 4shared and it an iPhone game . It show up and my iTunes but I can't sync it to my phone I need help

    Hello need help I download a game from 4shared and it an iPhone game . It show up and my iTunes but I can't sync it to my phone I need help

    Wowowowow I was told I can get any app from the net and it will work thank

  • I need a refund for storage charges I bought and did not need for iCloud!

    I need a refund for storage charges I bought and did not need for iCloud!

    You only have 15 days to cancel and get a refund.
    In the UK click on this link:
    HT4874 iCloud Storage Upgrade refund

  • I currently have one input but need to run two loops. I cannot get the two while loops to run so that they both pick up the same data, they are both picking up alternate samples. How can I get them to both pick up all of the values?

    The system I am trying to create calculates a number of values based on an input. I need to make the calculations and display the values for an entire production run and for each hour. The only way I know to do this is to create two while loops, one looking at all the values that are received and one looking only at the values for hour long periods.
    Any help would be great.
    Thanks
    RossH

    Why do you think that you have to have two loops to accomplish this task? Why not use one loop and accumulate the same data into two data sets based on the two sets of criteria?

  • Need Help waiting for user input.

    I've got a simple card game, which I've pretty much made all with swing. I have a JTextField and a JButton. I want the user to input a number into the textfield and the click the button which fires the action listener. This then takes the text and reads it and set a boolean hasBid to true. I don't want to program to continue until this has happened so I made an empty while(!hasBid) loop. The first time through, the program starts and stop until the user inputs something and click the button. The second time through, however, the whole window freezes. For somereason object aren't even being displayed which are displayed before this while loop. Without the while loop, everything runs fine, but the program won't stop to wait for input.
    So, my question pretty much is how can I get the program to stop for user input in a function which will be called multiple times. I don't want to use a JOptionPane or anyother pop-up box. If my way won't work, I'd really like to know of another way. Thanks for any help!

    you simply need to separate the functionality of your input object and the card game into two threads. as sanbingo said, running in a while loop prevents your GUI from even drawing its components.
    Remember: AWT/Swing is an event driven interface! so only events can/should cause some action to happen.
    i'd properly implement an event listener which is fired when the input is received. the listener is your game class which upon receipt of the event starts playing. when its done, its done, ie doesn't do anything until it receives an new event from your input object.
    thomas

  • Hello i need help looking for fire fox 64 bit i have 32 bit it really slowing down my laptop

    hello I was told there was a 64 bit that I can use for fire fox iam using windows 8.1 but I can only find fire fox 32 bit I need help to get 64 bit plz and thx

    locking this question as duplicate, please continue at https://support.mozilla.org/en-US/questions/1047357

  • Need help/advice for XB270HU monitor. G-SYNC does not work. Monitor Flickers. No signal.

    I recently bought this Monitor and have been having constant issues with it. Before I start, here are my specs. 
    GPU:GTX Asus Strix 970
    CPU:i5 4690k @3.5GHz
    RAM:16gb
    OS:Windows 7
    All my drivers are up to date, and in the NVidia control panel G-Sync is turned on. However while gaming I still get horrible stutters everytime the FPS fluctuates even a tiny bit even going from 140FPS down to 90 FPS. I was under the impression that changes to FPS it would remain smooth down to 30/40 FPS? Not so at all. There is no difference between this and my old monitor besides the fact that it can go up to 144hz. 
    Secondly everytime I turn on the monitor, it goes black and says no signal and then proceeds to launch at 800:600 resolution, flicker black, 1920:1080, flicker again and arrive at 2560:1440. Sometimes it wont ever receive a signal and my second monitor will turn on instead and take place as primary monitor. 
    It is plugged into the Display port and is secure, as far as I can tell the chord is in good condition.
    And finally sometimes during gameplay, ableit rarely, I get random flickers of black screen for half a second here and there. When this occurs it happens about 3-4 times and then stops. Worrisome! 
    Part of me hopes that I have a terrible, broken and faulty monitor and could get a replacement. Because then I wouldnt try to justify why I spent nearly $1,000 dollars before tax for this thing. But then the other half of me would not even want to get a replacement because of how big of a let down this one has been. I'd rather just never have bought this one at all and have my money back. 
    Any help or suggestions are appreciated. If anybody has had similar problems please speak up!!

    Booserbob,
    If you are willing, I would like to see about having a new Display Port cable sent out to see if that resolves it. If it does, I would be interested in obtaining the cable you received with the monitor, I have been trying to get one from a customer having this issue with no success as of yet. If you are interested, send me a PM (private message) with the following information and I will get to work on it:
    Serial number:
    Contact name:
    Contact number:
    Email address:
    Shipping address:
    Purchase date:
    Resolution attempting to use:
    Max resolution monitor will work at 144 Hz:
    Video cards is use:
    Video Connection:
    Symptoms: 

Maybe you are looking for

  • How do you burn a data Back up DVD from the finder?

    Is there an easy way to just burn a data back up disk using a Dual Layer DVD (I have the latest Macbook pro), using the finder or other stock apple utility? thanks for your help.

  • Assign resources to all ISA - hang

    Hi all, i recently made 2 new computers with this specs: K8N Neo2Platinum A64 3200+ (939) A-data 2*512 MB 400 MHz Ati X800 PRO Maxtor SATA 200 GB PSU: no name 350 W, +3,3 - 15A, +5 - 15A, +12 - 9A or alternative (i have changed it), no name psu, 300W

  • Center vertically and horizontally with a single layout?

    verticalLayout has the horizontalAlign property, and horizontalLayout has the verticalAlign property.  How can you use a particular layout to determine the flow of the children, but also specify vertical and horizontal alignment?  In Flex 3 this was

  • How to transport bi objects in to r/3 production

    sr, i have created one dso along with the transformation,infopackage, reports,infoobjects etc, now i want to transport all these objects in to production,kinldy tell me the steps to transport them into production also what are the precautions to be t

  • How to suppress unit of measure in structure

    hi, i am using a structure values based on fiscal period. I would like to suppress unit of measure for the values. For normal key values without using structure, I can suppress unit of  measure by function NODIM. But i am not able to use that here. H