Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Re: HELP BEGINNERS

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: HELP BEGINNERS

    Can you write a code for my question please

    Write a static method named displayPromptGetResponse with the following header:
    public static String displayPromptGetResponse( final String PROMPT)
    Using the showInputDialog of JOptionPane the method must display the string passed to it in the String parameter and return the String value returned by the showInputDialog method.
    System.out be should be similar to:
    PROMPT:
    Enter a two digit decimal number.
    Write a static method named displayOutput with the following header:
    public static void displayOutput(final String OUTPUT)
    Write a static method named displayTerminationMessage with the following header:
    public static void displayTerminationMessage()
    In this question you must use the methods displayPromptGetResponse and displayOutput as described above for all input and output. The main method must end with a call to displayTerminationMessage.
    Write a java program that asks the user to enter a hexadecimal number. The hexadecimal number may contain from 1 to 3 hexadecimal digits. A hexadecimal digit is any of the characters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F and the decimal equivalents are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 and 15. Convert the number to decimal and display the result.
    Write a method named hexDigitToInt with the following header:
    public static int hexDigitToInt(final char HEX_DIGIT, final int ALTERNATE)
    Write a method named fromHexToInt with the following header:
    public static int fromHexToInt(final String HEX, final int ALTERNATE)
    The parameter HEX holds a String of from 1 to 3 hexadecimal digits.
    Set the value of ALTERNATE to -1. Request the input from the user and check that the input is not null and that the number of characters entered is valid. If not, display an appropriate message using displayOutput. It is useful to use the trim method to discard any leading and trailing whitespace from the input. If the input is valid, call fromHexToInt to convert the hexadecimal number to a decimal integer. If fromHexToInt returns the ALTERNATE value an error has occurred during the conversion and an appropriate message must be displayed, otherwise the decimal integer is to be displayed. Remember to call displayOutput to display output from the program.
    Click on the Cancel button in the input dialog box. The output should be similar to the following:
    PROMPT:
    Enter a hexadecimal with at most 3 digits.
    RESPONSE:
    null
    OUTPUT:
    The cancel button was selected, program terminates.
    Programmed by Stew Dent.
    Date: Fri Sep 23 12:00:07 CDT 2011
    End of processing.
    Click on the OK button without entering any input into the input dialog box. The output should be similar to the following:
    PROMPT:
    Enter a hexadecimal with at most 3 digits.
    RESPONSE:
    OUTPUT:
    Invalid number of hex digits, program terminates.
    Programmed by Stew Dent.
    Date: Fri Sep 23 12:02:20 CDT 2011
    End of processing.

    PROMPT:
    Enter a hexadecimal with at most 3 digits.
    RESPONSE:
    ABCD
    OUTPUT:
    Invalid number of hex digits, program terminates.
    Programmed by Stew Dent.
    Date: Fri Sep 23 12:06:03 CDT 2011
    End of processing.
    Enter AbC into the input dialog box. The output should be similar to the following:
    PROMPT:
    Enter a hexadecimal with at most 3 digits.
    RESPONSE:
    AbC
    OUTPUT:
    AbC is not a valid hexadecimal number!
    Programmed by Stew Dent.
    Date: Fri Sep 23 12:10:11 CDT 2011
    End of processing.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: HELP BEGINNERS

    a) Do not hijack someone else's post. I have moved this to the appropriate location
    b) Do not post the same thing twice - your other post has been removed.
    c) These forums are not to help one cheat. In other words, no, we will not do this for you. Should have make an effort and have problems along the way, post a specific question with accompanying code and we will try to help you learn.

Similar Threads

  1. HELP BEGINNERS
    By javabeginners in forum Java Theory & Questions
    Replies: 13
    Last Post: November 15th, 2011, 12:50 PM
  2. package for Beginners
    By god1gracious in forum Java Theory & Questions
    Replies: 3
    Last Post: October 4th, 2011, 09:24 PM
  3. where is the java tutorial for beginners
    By javaque in forum Java Theory & Questions
    Replies: 2
    Last Post: September 14th, 2011, 03:30 AM
  4. YAY for beginners
    By derbya in forum Member Introductions
    Replies: 2
    Last Post: August 16th, 2011, 04:54 AM
  5. [SOLVED] Books and sources for Java beginners
    By chronoz13 in forum Java Theory & Questions
    Replies: 1
    Last Post: April 15th, 2009, 08:36 AM