Trying to make a loop and repeat a question.

Hello all,
I am trying to get a question to repeat itself only if the user enters an invalid amount. I have got the program to generate the invalid question "This is an invalid rate of pay, please enter a valid rate of pay.", but after the program produces this question, the program will still continue (ask the next question) as if the input was valid. I have tried several different if and while statements to try to manipulate the program to call the previous question, but it will not????? Thank you all in advance.I am at a loss. Can someone help please???? Here is the section of code:
// Employee's hourly rate.
System.out.print( "Enter hourly rate of employee:" );
Double employeeHourlyRate = input.nextDouble();
System.out.println();
// Monitors pay rate for validity.
if ( employeeHourlyRate <= 0 ){
System.out.println ( "This is an invalid rate of pay, please enter a valid rate of pay." );
//Loops back to hourly rate question.
I THINK THIS IS WHERE I NEED A LOOP COMMAND.?.?               
} // Ends loop program.

Hello and thanks for the advice! I have reconstructed as you suggested. However I am receiving 3 errors. I would also like the program to just repeat the question "Enter hourly rate of employee:". Here are the errors. How do I make this work? Thanks for the help. If it makes a difference I am running windows XP and using text pad.
1. Payroll1.java:34: cannot find symbol
symbol : variable employeeHourlyRate
location: class Payroll1
while( employeeHourlyRate <= 0) {
2. Payroll1.java:75: cannot find symbol
symbol : variable employeeHourlyRate
location: class Payroll1
else { grossPay = employeeHourlyRate * employeeHoursWorked;
3. Payroll1.java:82: cannot find symbol
symbol : variable employeeHourlyRate
location: class Payroll1
System.out.printf( "\nHourly rate: $%.2f", employeeHourlyRate );

Similar Messages

  • HT1040 trying to make an ibook and have 800 photos, want format of 8 photos/page, but default is not that- "create" the initial book from iphoto "album" it loads less than 800 pics and then when i change layout i have blanks.

    trying to make an ibook and have 800 photos, want format of 8 photos/page, but default is not that- "create" the initial book from iphoto "album" it loads less than 800 pics and then when i change layout i have blanks.
    if i clear the book so that it is all blanks and then try to load in the pictures i have it loses the chronology of the pictures that i had established in the album.
    is there a way to import photos into an ibook template and keep the original order of the photos without having to do them one at a time?
    also, is there a way to insert a photo rather than just dragging it? i have tried the cut and paste funciton but it doesn't seem to work, the target site doesn't seem to register with iphoto.
    many thanks for your help.

    Photos are added to book in chronological order.  So if you want to add them to a book in the order you have placed them manually in an album do the following:
    1 - select all the photos in the album.
    2 - use the Photos ➙ Batch Change ➙ Date menu option as shown here. Select any date and add 1 minute between photos.
    3 - select just one photo from the album and create a book from it.
    4 - in the book click on the Options button ➙ Book Settings button and make sure the checkbox for Auto-layout pages is unchecked.
    5 - drag the album with your book photos onto the book icon and they will be imported into the Photos tray of the book in your pre-determined order but not into the pages themselves.
    OT

  • Trying to make a purchase and it says that iTunes doesn't support or is not installed what do I do?

    Trying to make a purchase and it says that iTunes doesn't support or is not installed what do I do? Or that I'm not signed in

    Do exactly what it told you to do and contact itunes support

  • I'm trying to make a purchase and I get a message that the information does not match with the bank. What can I do?

    I'm trying to make a purchase and I get a message that the information does not match with the bank. What can I do?

    Go to the APP store or Itunes. On the bottom of the mainpage, tap your apple id, view account. Then you can edit the payment information. Or you can do it(if you encounter a problem there) on Itunes on computer. Just go to the store, select your name and edit information. Make sure everything matches...exp date, name as appears on card etc..

  • I am trying to make a purchase and want to use my Apple ID Balance and NOT charge the debit card under my account info.  How do I do this?

    I am trying to make a purchase and want to use my Apple ID Balance and NOT charge the debit card under my account info.  How do I do this?

    As far as I'm aware iTunes always charges the account balance first and when this expires charges any remaining amount to your credit/debit card. The one exception I am aware of (though there could be others) is that Apps purchased from the Canadian store must always be charged to a card rather than a gift card voucher balance due to local legislation.
    tt2

  • Trying to make a calendar and every picture is coming up too low of quality

    I am trying to make a calendar for my mom's Christmas present, but every picture I put in the calendar to be the month's picture has a caution box in the corner and says "This photo may print at too low of quality". I just don't know if this is normal with using your own pictures but I don't want to spend the money on this calendar and then it not turn out very good. Please let me know what you have done or if there is anything to do.

    Welcome to the Apple Discussions. What are the pixel dimensions of the pics you're trying to use?
    I ran a test on a calendar using the picture theme and for a full page photo to avoid the warning triangle it must be approximately 1535 px x 1181 px or roughly 120 dpi.
    You'll have to decide how far below that level those pictures are and decide if it's worth the gamble. Or use layouts which have more photos per page and thus require smaller sizes.
    Message was edited by: Old Toad

  • I should know better - I'm trying to make a DVD and...

    I cannot not even get a build done becuase I'm using stories and I get a message that states "Story 1: Stories must contain at least one entry". This is weird because when I simulate the disc, it seems to work fine – but trying to make a build cannot be completed b/c of the story issue. I have 20 markers in a track and the tracks markers are in the story yet this happens over and over....anyone have any ideas?
    Sleepless in NY

    Take a look at Story 1 in the inspector, you probably do not have a marker in it - they need to be on the right hand side, not the left
    The ones on the left need to be dragged to the right to be in the story (take a look at the story tab in the above graphic)
    Also
    http://dvdstepbystep.com/stories_details.php

  • Tried to make a subnet and failed, now i can't re-connect to the internet

    i tried to extend the current network with my airport extreme, but the main router was not a mac product so it did not work. now i just want to re-connect with the main router so i can use the internet on my computer. the main network is still up and running for other people, i can access the network but am unable to use the internet.
    anyway to fix this? i already tried to restart the router, and the modem. unfortunately both attempts were unsuccessful.
    -thanks in advance

    Ok, you will not be able to extend the wireless range of the main router with your AEBS. What can be done is that you can connect the AEBS directly to this router using an Ethernet patch cable. If this is not the configuration that will work for you, then you will have to use a product that will perform this function from the same vendor as the main router.
    If your Mac is unable to get Internet access wirelessly from the main router then there may still be something amiss with the AirPort settings on your Mac. Like the Mac's built-in Ethernet, the built-in AirPort also must be configured as a DHCP client in order to "automatically" get the IP information from the main router.

  • For Loop and Void Method Questions

    Question 1: How would I write a for loop that repeats the according to the number entered, to prompt the user to enter a number (double) between 1 and 100. If the number is outside this range it is not accepted.
    Question: 2 Also how would I write a for loop to do sum and find the average of the array numbers in a seperate void method( does not return anything to the main method)?
    Question: 3 (first code snippet) With my for loop that is used to process each number in the array and square it and cube it and display the results to 2 decimal places. How do I make it so say I want the array to allow me to enter 2 numbers (so I enter 2 numbers) then it asks me to enter a number between 1 -100 (which will prompt 2 times) that it shows me the results for the entered numbers between 1-100 after one another instead of number then result number then result like I how it now.
    for (int index = 0; index < howNum; index++) // process each number in the array
              enterYourNumbers = JOptionPane.showInputDialog   
                            ("Enter a number between 1 and 100");                       
              numArray = new double[howNum]; 
            try
                numArray[index] = Double.parseDouble(enterYourNumbers);
            catch (NumberFormatException e)
                    enterYourNumbers = JOptionPane.showInputDialog
                              ("Enter a number between 1 and 100");                          
                DecimalFormat fmt = new DecimalFormat ("###,###.00");
                JOptionPane.showMessageDialog(null, enterYourNumbers + " "  + "squared is "  + fmt.format(calcSquare(numArray[index]))
                                              + "\n" + enterYourNumbers + " " +  "cubed is " + fmt.format(calcCube(numArray[index])));                                                                           
                wantToContinue = JOptionPane.showInputDialog ("Do you want to continue(y/n)? ");
      while (wantToContinue.equalsIgnoreCase("y"));
    import javax.swing.*;
    import java.text.DecimalFormat;
    public class Array
        public static void main(String[] args)
            int howNum = 0;
            int whichNum = 0;     
            double[] numArray;
            boolean invalidInput = true;
            String howManyNumbers, enterYourNumbers, wantToContinue;
      do // repeat program while "y"
          do // repeat if invalid input
            howManyNumbers = JOptionPane.showInputDialog
                        ("How many numbers do you want to enter");                     
            try
                 howNum = Integer.parseInt(howManyNumbers);
                 invalidInput =  false;
            catch (NumberFormatException e )
                howManyNumbers = JOptionPane.showInputDialog
                            ("How many numbers do you want to enter");
          while (invalidInput);
          for (int index = 0; index < howNum; index++) // process each number in the array
              enterYourNumbers = JOptionPane.showInputDialog   
                            ("Enter a number between 1 and 100");                       
              numArray = new double[howNum]; 
            try
                numArray[index] = Double.parseDouble(enterYourNumbers);
            catch (NumberFormatException e)
                    enterYourNumbers = JOptionPane.showInputDialog
                              ("Enter a number between 1 and 100");                          
                DecimalFormat fmt = new DecimalFormat ("###,###.00");
                JOptionPane.showMessageDialog(null, enterYourNumbers + " "  + "squared is "  + fmt.format(calcSquare(numArray[index]))
                                              + "\n" + enterYourNumbers + " " +  "cubed is " + fmt.format(calcCube(numArray[index])));                                                                           
                wantToContinue = JOptionPane.showInputDialog ("Do you want to continue(y/n)? ");
      while (wantToContinue.equalsIgnoreCase("y"));
        public static double calcSquare(double yourNumberSquared)
            return yourNumberSquared * yourNumberSquared;       
        public static double calcCube(double yourNumberCubed)
           return yourNumberCubed * yourNumberCubed * yourNumberCubed;              
        public static void calcAverage(double yourNumberAverage)
    }

    DeafBox wrote:
    Question 1: How would I write a for loop that repeats the according to the number entered, to prompt the user to enter a number (double) between 1 and 100. If the number is outside this range it is not accepted. Use a while loop instead.
    Question: 2 Also how would I write a for loop to do sum and find the average of the array numbers in a seperate void method( does not return anything to the main method)? Why would you want to use 2 methods. Use the loop to sum the numbers. Then after the loop a single line of code calculates the average.
    Question: 3 (first code snippet) With my for loop that is used to process each number in the array and square it and cube it and display the results to 2 decimal places. How do I make it so say I want the array to allow me to enter 2 numbers (so I enter 2 numbers) then it asks me to enter a number between 1 -100 (which will prompt 2 times) that it shows me the results for the entered numbers between 1-100 after one another instead of number then result number then result like I how it now. If I understand you correctly, use 2 loops. One gathers user inputs and stores them in an array/List. The second loop iterates over the array/List and does calculations.

  • Trying to make a looped animation outside of comp space: expression or keyframe?

    Not quite sure on how to title it but thats the jist if it:)
    Hello and thank you for your time,
    Basically, I want to take a tiny small shape object within a comp size of 2048 x 1024, and have it animated so that this small shape object starts at the very top edge of the comp (where comp meets the grey dark-matter space), and move it straight down to the bottom edge of the comp, and then have to repeat again starting at the top again, so that this small shape object is constantly starting at the top, and moving down to the bottom.
    From there I can adjust speed and even angle of travel so that I can rotate the trajectory and have it move at an angle for example.
    Is there a expression that can repeat this tragectory over and over again without me always keyframing it??
    D

    You can set 2 position keyframes then add this expression to the Position property.
    loopOut("cycle")
    that will get you to the looping movement stage of your project. Now Pre-compose the layer and add time remapping to adjust the speed.
    I'll have to think of a way to automate the rest. It will involve some advanced expressioneering.

  • I'm trying to make a poster and invert part of it but the black is coming out as a beige colour instead of white.

    I can't figure out why this is happening - I've remade this document from scratch twice and each time it did this. I made a new adjustment layer with an invert mask on it, and instead of the black coming out as white, it came out as this beige colour. I tried to fix it myself, but was unable - I adjusted the colour profile, changed the colour, as well as fooled around in the menus trying to figure it out. I've inserted a screenshott of my workspace, as it was when the problem happened. Any help would be appreciated!

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Help - trying to make a video and imovie won't import the required video

    the video i need has been converted using handbrak to mp4 and yet remains white when i try to import.
    please help as i need to make a video for work and desperately running out of time now.
    ruth

    for the converted file its:
    /Users/ruthmccaig/Desktop/newyouth.m4v
    and the original:
    /Users/ruthmccaig/Desktop/newyouth.wmv

  • How do I find out the size of a file, trying to make a DVD and told the fil

    Made a slide show project with music and trying to write to dvd. Computer tells me the file is to large and to use a dual sided disk. I cut may slides out but no luck. How do you find out the file size?

    Hi
    And SlideShows has a limit of 99 slides per show.
    I rather assemble mine in iMovie HD 6 where as QuickTimeKirk states
    it only has Time as a limit dep. on encoding method selected and if Single or Double layer DVDs
    Single Layer (for DL double time) - TIME includes menu - keeping it simple gives more to movie.
    (I prefere "Brushed Metal" no audio, no animation.)
    • Professional Quality (movies up to 120 min.) - BEST
    • Best Performances (movies less than 60 min.) - High quality on final DVD
    • High Quality (in iDVD08) / Best Quality (in iDVD6) (movies up to 120 min.) - slightly lower quality than above
    Yours Bengt W

  • I tried to make a purchased,and after i updated my billing address which required.then it still not working.

    i wanted to make a purchase,after i renew my billing address which has been required and said it was expired,i still cant get it done.it shows my payment method was declined ,pls enter valid payment method.what can i do now?

    Maek sure the Security Code is correct. iTunes Store: My credit card's security code or zip code does not match my bank's records
    Billing policy is the same for both the iTunes and Mac App Stores.
    Also, if by chance you changed the App Store country, be aware that your credit or debit card credentials must be associated with the same country where you reside.

  • I have 12 brand new installs of 27" I-Macs, all running Adobe CC. I have several users trying to make simple saves and getting Error -108 Out of Memory errors.

    The Mac OS is 10.9.5.
    I've already gone into plug ins and Scratch disk preferences and changed the secondary  location to the user's hard drive, but this does not solve the problem.
    I cannot change the "primary " from Startup, but I did change the secondary to the user's ID instead of None.
    These are all brand new Macs in use no more than two weeks.

    Windows 7 includes DirectX 11 in its baseline and it is not necessary to install another version of it.  Your problems may be caused by the installation of the version of DirectX you installed.  Uninstall the one you installed and see if you
    still have the errors.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

Maybe you are looking for

  • Inserting a logo into the header and footer

    Hey Team  I have a workbook with 5 worksheets. On sheet1 I have a button programed to open a new Word document; pull information from fields on 3 other sheets and creates a letter from that data. I have two company logos pasted into sheet5, Pic1 and

  • How to get subject text and Reference Object both Screens at the Header lev

    Dear Experts ,                 I am getting only Notification Header Screen ( Subject Text, Notification system and User Status) at the Header of Notification and different Tabs under that screen.                 I want Subject Text and Reference Obj

  • How to send as Delegate or on behalf of someone else

    We use to use an Exchange server and Entourage. This allowed us to use a delegate feature, which in essence allows an assistant to send a message on behalf of a manager using that managers email address. We have migrated our mail to a new, non exchan

  • Junk characters using form MR_PRINT

    Hi friends, My user generated Invoices using MRRL and generated output using MR90. Spool created for these invoices. But in the print, we are getting some lines with junk characters. It looks like chinese characters. 1. If I see the Spool print previ

  • How to set item values when redirecting to the same page.

    I just created a redirect button that I want to redirect to the same page and set the 2 page items on the page to the same value they had before the redirect. But I can't write: Set These Items: P1_Permit_Number,P1_Fishing_Year With These Values: &P1