Trying to produce error message

Hi
Im fairly new to Java programming and am in the middle of completing a small assignment.
I'm trying to get the program to produce an error message after it asks a user to "Press 'Q' to Quit or 'P' to Print". Although the prog doesn't carry on if any other keys are pressed it doesnt actually produce an error message but thats what i want it to do.
Can someone please help!
public void display(){
  String printQuitResponse;
  int printBook;
  try {
   do {
    int bookChoice = 0;
    System.out.println("\nPress 'Q' to Quit or 'P' to Print details of a book.");
    printQuitResponse = reader.readLine();
      if (printQuitResponse.equalsIgnoreCase("P")) {
        System.out.println(
            "\nWhich book would you like to see the details of (1, 2, 3)");
        try {
          bookChoice = Integer.parseInt(reader.readLine());
        } catch (IOException ioe) {
        } catch (NumberFormatException nfe) {
          System.out.println("Invalid entry, please try again.");
         if (bookChoice == 1 || bookChoice == 2 || bookChoice == 3){
           System.out.println("\nTitle: " + title[bookChoice-1] +
                              "\nAuthor: " + author[bookChoice-1] +
                              "\nShelf Location: " + sLocation[bookChoice-1]);
           if (availability[bookChoice-1] == true) {
             System.out.println("Available: Yes");
           else if (availability[bookChoice-1] == false) {
            System.out.println("Available: No");
   }while (!printQuitResponse.equalsIgnoreCase("Q"));
   catch (IOException ioe) {
      System.out.println("Invalid entry, please try again");
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

printQuitResponse = reader.readLine();you are waiting for any key followed by a "\r" | "\n" | "\r\n"
i.e. your program never leaves the readLine as long as the user
does not type <AnyKey><ENTER>

Similar Messages

  • Fix for iTunes Producer error message?  Fixing unallowable image names in iBA Gallery

    In Gallery I had image names with unallowable characters, e.g. "photo name.jpg".  I changed the name to "photoname.jpg" and re-added it in Inspector>Interaction>Gallery Media.  It still appears as "photo name.jpg"???  Even in a new Gallery Widget? 
    I'm new here so please forgive me if I am violating any protocol.  I would greatly appreciate any guidence in correcting my error. 
    Thanks!!!
    Gene Yore
    aka eeyore

    Thank you vinnyvg! 
    While trying to respond to this iTunes Producer error message,
    "ERROR ITMS-9000: "File given does not match type JPEG Image because of these validation issues: ; Error=com.apple.jingle.leghorn.fileformat.ValidationError@5fd2c84f[userString=This<mailto:Error=com.apple.jingle.leghorn.fileformat.ValidationError@5fd2c84f[userString=This> file does not start with a start of image marker.]" at Book (MZItmspBookPackage)
    The delivery of your book ended in error because there are image files that do not match the file extension type.  Make sure that all image files inside the book file end with one of the following: .jpg or .png and that the image file itself matches the file extension type."
    I did have a few tif images which I converted to jpg. 
    But, I ran across this posting which suggested I had other problems with my naming convention. 
    https://discussions.apple.com/thread/4788489?start=0&tstart=0
    which says
    GeePeeGee
    This solved my questionRe: Uploading error codes - does anyone speak their tongue? 
    Feb 15, 2013 9:33 PM (in response to GeePeeGee)
    So, it turns out, the problem with these png-images is the NAME. There are no restrictions, to name your pictures, but when you intend to use them in iBooksAuthor, make sure, that there are no "wrong charakters" in the name. You may use a to z charakters, 1 to 0 numbers and "-" and "_". That's it.
    The file "St. Giles.jpg" has
    a) a ".", which is wrong and
    b) an empty space, which is wrong too.
    When you use screenshots, things are getting even worse "Bildschirmfoto 2013-02-08 um 08.02.   15.50.19".
    So, if there are error codes as specified, you have to go through the document, click on each and every image and then check the filename. As you see below, you must activate the image itself to see the filename (in this case the filename is corrcect)."
    eeyor

  • Photoshop Elements 8 "Watch Files" function produces error message

    My new PE8 is on a Windows 7 laptop and my pictures are on a networked server operating under Windows XP. The Windows file sharing works fine and I have successfully imported all pictures into the new PE 8 organiser catalogue. So far so good. However, when I try to implement "Watch Folders" by using the "Browse" command, the correct path "\\server\Data (D)\Server-pictures\" comes into the "Watch Folders" window. Then, when I click on "OK",I receive an errror massage: "The Watch Folder Service returned an error "Access is denied". Does anyone have a solution to the problem?

    Hi John,
    Thank you very much. I will try that tomorrow (I'm in Germany and its getting late!). Please can you tell me how to apply the "UNC syntax (\\mycomputer\photos)" you mention to the path which the Browse command in the Watch Folders set-up produces. That is: " \\Server\Data_(D)\Server_Pictures\".
    Also if you have another clue about how to deal with the change to "Services" it would help a lot. I have tried to do as you suggest and after I've put the user password in, I get  a message "System Service Management could not detirmine whether the account "Admin1-pc\Tom" already has the Log on as a Service right. If not the Service might ot run correctly" When I restart the service I sure enough get the error message "1069 Windows could not start the service due to log on failure". What have I not done?Thanks in advance for your patience!

  • Contact sheet produces error message

    I installed the contact sheet files and folder but it opens CF5 and produces an error message.
    Have I installe it wrong? see attachment

    As you know the Contact Sheet was discontinued in CS5 and replaced with a similar program in Output.  But if you like Contact Sheet here is a former response to a post that may help you.
    Can not verify this is the correct approach.  Might want to google "Adobe Bridge CS5 contact sheet" and see if this address is used by others.
    I use Win 7 64 BIT
    I make pdf output in Bridge CS5 but not work.
    I downloaded optional filters and I tried in to read me files path but it doesn't work.
    Now I find a new path and put in the "bridge Startup Scripts" file there. They working perfectly.
    The path is the bottom:
    ... /Program Files(x86)/Common Files/Adobe/Bridge CS5 Exkensions/Adobe Output Module/Resources/Scripts
    Copy all files and folders "PSCS5OptionalPlugins_Win_en_US/Bridge Sturtup Scripts" paste in to this folder at the path
    ... /Program Files(x86)/Common Files/Adobe/Bridge CS5 Exkensions/Adobe Output Module/Resources/Scripts

  • Getting error message when trying to display error messages on a ProfilePage

    Hi All,
    I'm getting following error message when trying to display error on a Profile page.
    On page i'm seeing this:
         org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
              org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
              org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:405)
    In condole, i'm seeing this:
         18:23:00,206 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
              java.lang.IllegalStateException: getOutputStream() has already been called for this response
                 at org.apache.catalina.connector.Response.getWriter(Response.java:621)
                 at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:198)
    Please let me know what could be the reason.
    Thanks,
    Vishnu

    HI David And Nitin,
    Here is the code using which i'm trying to display the error messages on registration page, but this code fragment is outside registration form will that cause any problem?
    <dsp:droplet name="Switch">
      <dsp:param name="value" bean="ProfileFormHandler.formError"/>
      <dsp:oparam name="true">
      <table>
      <dsp:droplet name="ProfileErrorMessageForEach">
      <dsp:param name="exceptions" bean="ProfileFormHandler.formExceptions"/>
      <dsp:oparam name="output">
      <tr style="color: red">
      <td><dsp:valueof param="message"></dsp:valueof></td>
      </tr>
      </dsp:oparam>
      </dsp:droplet>
      </table>
      </dsp:oparam>
      </dsp:droplet>
    Thanks,
    Vishnu

  • Itunes producer error message is driving me nuts

    Hi,
    I'm almost at the end of my rope with this problem.  Why is uploading to iTunes so difficult?  I've created an epub file in Sigil which tests ok in Sigil and FlightCrew. But when I try to upload it to iTunes, Producer keeps giving me this error message:
    ERROR ITMS-3000: "Line 98 column 54: character content of element "file_name" invalid; must be a string matching the regular expression "[^./: ]+([.][^./: ]+)+" at XPath /package/book/assets/asset[2]/data_file/file_name"
    I've gone through the Sigil contenopf file looking for strange characters but can't find anthing (I've even changed the document copyright sign to (c) just incase).  Can anyone tell me in plain simple English what this error means and how I can fix it?

    I know pretty much nothing about producer (never heard of it until your post).  I do notice in the other forum one one line of code produces a smiley symbol which suggests there's some invisible character or code that's at least generating this in a web browser.  It's not position 54 though.

  • Printing from Preview produces error message "The file couldn't be opened".

    Hi,
    Ever since the upgrade to OS X 10.8, I get the error message "The file couldn't be opened" each time I want to print from Preview. I just have to click "OK" and then everything prints fine, but if anyone knows how to get rid of this message, it would be even better!
    I have run "Verify disk permissions" without success.
    The system is on an SSD volume whereas my home volume is on an internal HD. But other users with (smaller) accounts residing on the system volume have the same problem.
    Each time I open the print dialog, the following message appears in the logs:
         com.apple.Preview.TrustedBookmarksService[2159]: Failure to de-serialize bookmark data file.
    I removed  files related to Preview in ~/Library/Preferences/
    There is no *.plist file in ~/Library/Application Support/Preview
    Thanks!

    Pages 5.2 Mac OSX 10.9.2
    Start Pages app
    Create a blank document
    File > Save or <Command>+S
    Select Mac Device and find your user folder or favorite, Desktop (not iCloud)
    Error: the file "Untitled.pages" couldn't be opened!?!
    Repeat giving the document a different name and it works
    Since when do we write error messages with "n't"?
    Usually a well written error message offers a suggestion as to what you might do about it?
    Since it says opened and I clicked on Save, there is a bug in there somewhere.
    All I was trying to do today was copy and paste some text from a website into numbers spreadsheet
    Both Edit > Paste options but the text in one cell so I tried to save it as a text file first to try and import the data
    Text Edit does not have a text only export format so before loading Terminal and starting vi or emacs, I tried pages. I'll go try XCode's editor or my Windows 7 vm with notepad and openoffice
    I miss the old Pages with the Appleworks importer, this one needs more Quality Assurance Testing IMHO
    WWSJD "What Would Steve Jobs do?"

  • My iPod won't sync to iTunes because my computer is not authorized. Tried authorizing and error message pops up?

    Just noticed an error when syncing my iPod touch to iTunes...
    Tried authorising and this message pops up...
    After that, I tried to sync again and the same message pops up (1st one)...
    Do you know any ways to fix/resolve this issue?

    Try DFU mode and then restore               
      How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    iTunes: Restoring iOS software
    - New cable and different USB port
    - Run this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Also see:
    iPod not recognised by windows iTunes
    Troubleshooting issues with iTunes for Windows updates
    - Try on another computer to help determine if computer or iPod problem

  • When trying to install error message says not a win 32 application

    downloaded ff4 from ff website and previously ff4 beta from ff and cnet same error message stating not a win32 application

    Have you had a look at this troubleshooting page? iTunes: Windows reports that iTunesSetup.exe is not a "valid Win32 application"

  • Lost itunes on pc after an update. Message said iTunes not installed.. Please reinstall. Tried to and error message "app failed because MSVCR80,dll was not found. Tried several times...same response. Finally uninstalled itunes and tried to reinstall . No

    Lost iTunes on pc after an update (Neighbor has same problem) Tried to open and message said " iTunes not installed correctly,Please reinstall itunes" . Tried to do so and same message with another message"application failed because MSVCR890.dll was not found.Re-installing may fix this problem" Tried several times and same message. Finally uninstalled itunes from computer and tried unsucessfully several times to re-install...Same messages as above appear when install looks like it's done......Help !

    Try the following user tip:
    Troubleshooting issues with iTunes for Windows updates

  • Trying to update "error message 20"

    I am getting an error message
    There was an error in the App Store. Please try again later. (20)
    when updating through the app store

    Sign out of the App Store and sign back in. Try to update again.

  • ITunes Producer error message

    After loading an epub onto iTunes Producer I received the following:  ERROR ITMS-3000: “Line 522 column 29:element”dat_file” incomplete; missing required element “checksum”.  Any idea on the problem?  Thanks.

    Did you get an answer or figure out this problem? I'm uploading a series of eBooks and I've been getting a variation of this message. Frustrating!

  • Trying to update: error message

    I was attempting to update today and somewhere in the process I had to disconnect my Iphone because it wouldn't sync. Now when I try to finish the process I keep getting the message "An unknown error occurred(6) what should I do?
    Thanks

    BTW each time I connect it to the PC it says "Iphone in recovery mode. You must restore this iPhone before it can be used with iTunes.

  • Answer: Explaining cryptic iTunes Producer error messages

    I ran into all kinds of cryptic errors when submitting a book to iBooks via the iTunes Producer program. It looks like Apple is using the Java program "epubcheck" and simply returning those errors to the user (not very user-friendly). I found explanations and solutions to many of the errors over at the epubcheck wiki (and even added one).
    http://code.google.com/p/epubcheck/wiki/Errors
    Just thought this may be useful for others as well.

    I got a reply from iBookstore support that fixed me right up.  My issue was not a JAVA issue.  Here's what they sent:
    You can make an update to your settings in iTunes Producer to avoid this issue.
    1. Open iTunes Producer
    2. From the iTunes Producer menu, open Preferences.
    3. Click on the icon for Advanced settings at the right side of the screen.
    4. Uncheck the box next to Signiant.
    5. Close settings and reattempt your delivery.
    You will be notified by email once Signiant is available again.
    Once I did that, my book delivered on the first try.  I'm fixed and thanks to Apple.
    Rocketman

  • Safari won't start - produces error message

    Safari won't start on my old iMAC. I have just installed Lion again but no way. I get a message saying that it quit unexpectadly and get three options: reopen, ignore, or report to apple. I tried themn all, with no luck.
    Any clues?

    Post a crash report..
    If Safari has just crashed, press the Report button on the CrashReporter dialog box to view the crash  information.
    Copy/paste the entire contents of the Crash Reporter window into your reply including the, "binary images" section.
    If the crash report dialog does not appear or the crash is hard to reproduce, crash logs can be retrieved from the ~/Library/Logs/CrashReporter> folder.

Maybe you are looking for

  • How ERMA is implemented in SAP Retail

    Hi I want to understand the concepts and process behing EMRA(Extended Retail method of Accounting). I have gone through the SAP standard keys, characterstics, Infosources and other features related to ERMA but i want ot understand how EMRA is actuall

  • Getting video on TV

    I am a new mac user and am curious how to play videos from my macbook on my TV...I have a cord that connects my iPod to my Tv that the guy at the apple store said could be used to connect my macbook as well but I am curious as how to do so... thanks

  • What is the URL for Nightly Start Page i want to use that in my Open a new tab?

    How can i find the URL for the new Nightly start page as i want to use it in the new tab so it is the same as the home page . i use the nightly start page as home page too

  • RP_PROIVDE_FROM_LAST

    hi friends, What is the proper use of RP_PROIVDE_FROM_LAST. thanks, SK

  • Re:Copy Condition record

    Is there any solution if I maintain the condition record of particular condition type ,the value of this condition record is auomatically copy to another condition record.