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: output wrong while creating linked list of nodes recent node should be head of list using java pgm

  1. #1
    Junior Member
    Join Date
    Jan 2021
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default output wrong while creating linked list of nodes recent node should be head of list using java pgm

    <<<<<<<<<<SAMPLE RUN OF PGM>>>>>>>>>>>>>>>

    B G C C C <<<<<First line Random generated>>>>>
    History:
    No History <<<<<NO HISTORY TO DISPLAY AS USER HAS NOT ENTERED ANY AS OF NOW>>>>>
    Enter melody: <<<<<USER ENTERS ANY 5 CHAR FROM A TO H>>>>>
    B G C C A
    History:
    B G C C A Correct 4 Out of Order 0 <<<<<HISTORY OF DATA DISPLAYED TILL USER ENTERS CORRECT NODE>>>>
    Enter melody:
    B G C C B
    History:
    B G C C B Correct 4 Out of Order 0 <<<<< CORRECT HEAD OF THE NODE IS MOST RECENT ONE ENTRED >>>>>
    B G C C B Correct 4 Out of Order 0 <<<<< WRONG RESULT THIS SHOULD BE B G C C A>>>>>
    Enter melody: <<<<< PGM CONTINUES TILL USER ENTERS CORRECT ONE WHICH IS B G C C C>>>>

    <<<<<<<<<<<<<<<<PGM function>>>>>>>>>>>>>>>>

    A Music Director thinks 5 notes from A TO H and user has to find those notes and
    history of notes entered by user are maintained in a linked list till user enters
    correct 5 notes

    PGM HAS 5 CLASSES

    Melody.java <<<<<Melody class object used to refer tune entered by user or thought by Director i.e 5 char array >>>>>

    Suggestion.java <<<<<Suggestion Class object takes Melody object of user and Melody Solution by Director(Random generated)>>>>
    <<<<<and calculates how many are correct >>>>

    SuggestionListNode.java <<<<<Maintain Suggestion objects in a list >>>>>
    Game.java <<<<constructor Generates Random 5 char array and User enter a 5 char>>>>
    <<<<<array the game continues till user enters Correct Melody tune>>>>>
    JingleWriterCli.java <<<<<Generates a Game object>>>>
    Last edited by vp.rao2005@gmail.com; January 12th, 2021 at 11:39 AM.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: output wrong while creating linked list of nodes recent node should be head of list using java pgm

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.

    The code needs some comments describing what it is trying to do
    and how it is going to do it.

    Please add some comments to the output showing what is wrong with it.
    For example:
    sample run of pgm

    B G C C C
    History:
    No History
    Enter melody:
    B G C C A
    History:
    B G C C A Correct 4 Out of Order 0 <<<< This should be C C C C C
    Enter melody:
    B G C C B
    History:
    B G C C B Correct 4 Out of Order 0
    B G C C B Correct 4 Out of Order 0 <<<<<<< Should not print second line
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Building a linked list whose nodes data is the sum of nodes of other list
    By AlaaAssaf in forum What's Wrong With My Code?
    Replies: 17
    Last Post: May 1st, 2014, 04:35 PM
  2. Nodes contain array data sets in a linked list. Need help iterating
    By Bawnawgwa in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 10th, 2014, 06:11 PM
  3. Linked list is not displaying the nodes correctly
    By Jpopto in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 7th, 2013, 02:02 PM
  4. swapping nodes in a linked list
    By ueg1990 in forum Java Theory & Questions
    Replies: 3
    Last Post: September 10th, 2012, 02:37 PM
  5. Linked list Schminked list help with Nodes Please
    By Bially in forum Collections and Generics
    Replies: 1
    Last Post: September 29th, 2011, 03:20 PM