2nd loop  combined the first and second statement lines...why?

I wrote this program to calculate the price. I want to have users to enter the item name and price continuesly, then once the hit 'f', it will give them the total. I was able to enter the first item and price but then the second time around, this is what show on my screen:
Item to purchase (enter F when finished): price for this is:
It combined the first and second lines in one line. I can't figure out why.
Please help.
This is part of my code below:
for (;;)
String F ="F";
System.out.print("Item to purchase (enter F when finished): ");
item=sc.nextLine();
if(item.equalsIgnoreCase (F))break;
System.out.print("Price of this "+ item +" is: ");
price=sc.nextDouble();

Insert a sc.nextLine(); before the nextDouble.
And insert a "\n" at final of System.out.print string.
for (;;)
String F ="F";
System.out.print("Item to purchase (enter F when finished): \n");
item=sc.nextLine();
if(item.equalsIgnoreCase (F))break;
System.out.print("Price of this "+ item +" is:\n ");
price=sc.nextDouble();
sc.nextLine();
}

Similar Messages

  • How to get the first and second quarter from CRT

    Dear Freinds,
                    I have one scenario , the Functional SPEC says Read the payroll results and from the CRT  get all the 4 quaters
    for the wage type /5UH  and sum them and then pass on the to field in the main strucutre.
    Iam using the FM HR_GET_PAYROLL_RESULTS
      CALL FUNCTION 'HR_GET_PAYROLL_RESULTS'
        EXPORTING
          pernr                         = fp_v_pernr
          permo                         = fp_v_permo
          pabrj                         = fp_v_pabrj
          pabrp                         = fp_v_pabrp
          actual                        = 'A'
        TABLES
          result_tab                    = i_payresult
        EXCEPTIONS
          no_results                    = 1
          error_in_currency_conversion  = 2
          t500l_entry_not_found         = 3
          period_mismatch_error         = 4
          t549q_entry_not_found         = 5
          internal_error                = 6
          wrong_structure_of_result_tab = 7
          OTHERS                        = 8.
    Iam collecting all the Actual Result (current result) values
    on the selection screen iam passing for month april (04 2008)
    so this falls in the second quater .
    the internal table   i_payresult is picking up only the second quater (01-04-2008 to 30/04/2008 )  ,but since on the selection screen iam pasing as other period (04 2008) the internal table  i_payresult  returing from the FM  (HR_GET_PAYROLL_RESULTS) only   picks the second quater,
    could any one let meknow how i can pick up the first quarter as well and add the first and second quater to mee the requirement .
    Please help me in this regard
    Thanks & regards
    maduri

    Hi Manoj,
                 Thank you for giving me idea for going further  regarding this problem , so my final question for this is
    as per FS they said they are going to enter the payroll
    area and the other selection as 04 2008 
    In order to achieve the first quarter , because 04 2008 means they are going to enter for the second quarter , the payroll results will come only for second quarter and not for the first quater , if they want to sum all the two quarters then they shouldnt pass on the selection screen   the dates as 04 2008, instead they has to pas
    01 01 2008 to 30 06 2008 , as there is no point in they passing as 04 2008 as we are going to consider from 01 2008 to 062008 .   Please correst me if am correct regarding the dates passing on teh selection screen
    or if the user enters on theslection screen still enter 04 2008 and will be  able to acheive the first quarter ??
    Please answer me this point before i can change the logic of the code and tell to my FO regarding this point.
    thanks & regards
    Madhuri

  • Calendar first and second alerts switch on their own

    Hi, I've been having this problem for a while with my iPhone 4, wondering if anyone can help.
    I've tried looking if there's already a thread for this issue, but couldn't find one -- maybe I'm just not using the correct keywords.
    Every time I set my first and second alerts on my calendar appointment and saved them, they seem okay, but 2 minutes later when I go back to the same appointment, the first and second alerts switch on their own, e.g.: I set first alert to go on 2 hours before and second alert to go on 1 hour before the appointment. Save. When I return 2 minutes later, first alert turned to 1 hour before and second alert 2 hours before.
    Which is silly, since who needs their second alert to be farther than their actual appointment? Even iphone knows this and cancels the second alert altogether. By the time I've been alerted, I only have an hour to get ready for my next appointment.
    Anyone has encoutered this problem and has successfully solved them? I've tried setting my default time zone under setting to local, and even turning off iCloud, to no success.
    Any suggestion is greatly appreciated. Thanks.

    I have found what appears to be a resolution to this issue, when I add an event and I select the event time, the date time scroller opens up allowing me to select the time of the event.
    The issue occurs when I leave this selector expanded and continue to set the event properties. When the time selector is still open and you select the alert times, it swaps the alerts every time. When you collapse the event time selectors before choosing the alert times, the alerts are not switched.
    This bug appears to be an issue with the scrolling selector form item if there is more than one open it appears to error out.
    If you don't know how to collapse the event time selector, once you have selected the time, click on the date/time that is in red text just above it and it will collapse the selector.
    Hopefully this fixes the issue for others, and it is ridiculous that this has gone one for so long, not a good way to keep your customers Apple, my wife was so aggravated at this that she was about to cancel her iPhone.

  • First and second letters reversed when I type

    Is anyone else finding this? When I type, quite frequently the first and second letters are reversed. It happens across programs, and only started after I installed Lion. I assumed it would be a temporary bug, but it persists, annoyingly.

    What version of FireFox are you using?  Try upgrading.
    https://discussions.apple.com/message/15121441#15121441

  • TS1424 I have downloaded a song and it will only play the first 18 seconds and starts again?

    I downloaded Clique by Kanye West on itunes and it all appered normal until you try to play the song either on my computer or iphone it plays the first 18 seconds and then goes to the next song even though it says the song is 4:52 any ideas how to fix this?

    Depending upon what country that you are in (music can't be re-downloaded in all countries) have you tried deleting it from your iTunes library and redownloading it via the Purchased link under Quick Links on the right-hand side of the iTunes store home page on your computer's iTunes ? Re-downloading.
    If you aren't in a country where you can re-download music or if it re-downloads in the state then try the 'report a problem' link from your purchase history : log into your account on your computer's iTunes via Store > View My Account and you should then see a Purchase History section with a 'see all' link to the right of it ; click on that and you should see a list of your purchases ; find that song and use the 'Report a Problem' link.

  • I purchased a season of downtown abbey and it only downloaded the first 30 seconds of every episode.  How do,I co

    I Purchased a season of downton abbey from iTunes on my iPad and it only downloaded the first 30 seconds of every episode..how do I correct this?

    You are trying to watch them in the Videos app and not the previews in the iTunes store app ? If you are then depending upon what country that you are in (TV programmes can't be re-downloaded in all countries) then try deleting those episodes from the Videos app on your iPad and then redownload them via the Purchased tab in the iTunes store app.
    If you aren't in a country where you can re-download TV programmes or if they re-download in the same state then try the 'report a problem' link from your purchase history : log into your account on your computer's iTunes via the Store > View Account menu option and you should then see a Purchase History section with a 'see all' link to the right of it ; click on that and you should see a list of your purchases ; find that series and use the 'Report a Problem' link and fill in details about the problem (iTunes support should reply within, I think, about 24 hours).
    If the 'report a problem' link doesn't work (it's been taking some people to this site on a browser instead of showing a form in iTunes) then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page.

  • My iPhone rejects my passcode when I enter it the first and the second time

    My iPhone rejects my passcode when I enter it the first and the second time. Why?

    Is it random? Does it occasionally accept the passcode, or does the passcode seem to be changed?
    See Kappy's list on how to deal with passcode problems:
    Re: Passcode being rejected   https://discussions.apple.com/message/23376400#23376400

  • TS1717 I just downloaded a song and it only plays the first 50 seconds and then moves to the next song in the list. How can I get it to play the rest of the song?

    I just downloaded a song and it only plays the first 50 seconds and then moves to the next song in the list. How can I get it to play the rest of the song?

    If your country's iTunes Store allows you to redownload purchased tracks, I'd delete your current copy of the track and try redownloading a fresh one. See the following document for instructions:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    Otherwise, I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not playing properly. If you can't see "Report a Problem" next to the item, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.

  • I attempted to download a song. It originally did not download correctly. I refreshed the download and it supposedly completed. Upon playing the song in both my library and on the Itunes store it will not play past the first 5 seconds. How can I fix this?

    It originally did not download correctly. I refreshed the download and it supposedly completed. Upon playing the song in both my library and on the Itunes store it will not play past the first 5 seconds. How can I fix this?

    Hello Whitney262,
    Thanks for using Apple Support Communities.
    I would go ahead and make sure you can first download the content, then remove the song from your iTunes Library, and download again from your iTunes past purchases.  The article below will walk you through the entire process:
    Download past purchases
    http://support.apple.com/kb/ht2519
    Take care,
    Alex H.

  • I was making a movie on iMovie, and was trying to use the green screen to make a split screen. I pressed on the green screen button, but the second clip didn't play next to the first, and only the audio played.

    I was making a movie on iMovie, and was trying to use the green screen to make a split screen. I pressed on the green screen button, but the second clip didn't play next to the first, and only the audio played. I tried again with some different clips and some worked and some didn't. This hasn't happened before. What should I do? (I am using iMovie '09)

    No guarantess but try smc and pram resets,

  • HT203433 I purchased a song and only the first 10 seconds downloaded.  How do I download the entire song without paying for it again?

    A purchased song only downloaded the first 12 seconds.  I do I download the song again since it is already been paid for.

    Welcome to the Apple Community.
    Try deleting the problematic tune (electing to remove original file if/when prompted) and then re-downloading the file from the iTunes store.
    You can re-download content purchased from the iTunes store (availability varies depending on location) using the purchased option from the Quick Links section in the top right corner of the iTunes homepage in your iTunes application on your computer.
    You can re-download content purchased from the iTunes store (availability varies depending on location) using the purchased option at the bottom of the screen of the iTunes app (or video app on your iOS device.
    If the problem re-occurs, select the content which is causing a problem and use the 'Report a problem' button in Your Purchase History using your computer.

  • TS3297 I downloaded a song but it did not download properly and only the first 5 seconds of the song plays.  How do you fix this and get the entire song downloaded?

    I purchased a song and when downloading there was an error.  No error on the other 8 songs just one and now only plays the first 5 seconds of the song.  How do you fix this and do the download again so the entire song is downloaded?  Thanks!

    Delete the song from your library and re-download it from the Purchases section of the iTunes Store.
    http://support.apple.com/kb/PH12491

  • HT1725 I have two songs Free and Keep Me In Mind and they play the first 8 seconds and then go to the next song.  I can't download them again.  What do I do?

    I have purchased songs and they only play the first 8 seconds and go to the next song.  I can't download it again, Itunes won't let me.  How do I get the songs?

    Try clicking on the Windows menu item then select downloads. 

  • Hey my little sister pressed something on my ipod and ever since some o f my songs are playing only for the first few seconds how do i solve this problem

    hey my little sister pressed something on my ipod and ever since some o f my songs are playing only for the first few seconds how do i solve this problem

    BaconBits is right to ask if the files are protected or not.
    DRM files can only be transferred using Windows Media Player, Creative MediaSource or Nano Media Explorer so that the licenses are transferred. Do not try drag'n'drop with Windows Explorer on porotected files. This is explained in the Help file manual on your CD.
    Also do not use Audible Manager to transfer music files.
    PB

  • Bought the song "Earthquakey People (feat. Rivers Cuomo)" from itunes and the song skips itself after the first 10 second (literally) what can i do

    I bought the song "Earthquakey People (feat. Rivers Cuomo)" from itunes and the song skips itself after the first 10 second (literally) and i have already deleted it ad downloaded it again and it still is doing the same thing what can I do?

    Contact the iTS Customer Service via the links on this page and explain the problem - http://www.apple.com/support/itunes/
    MJ

Maybe you are looking for