Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2010
    Location
    New Jersey USA
    Posts
    81
    Thanks
    13
    Thanked 4 Times in 4 Posts

    Question Java Program which can compare results to a master list. Expert programmer!

    Andrew: cherry
    Andrew: orange
    Andrew: apple

    Bryan: apple
    Bryan: orange
    Bryan: cherry

    Mike: orange
    Mike: cherry
    Mike: apple

    Correct answer: apple
    Correct answer: orange
    Correct answer: cherry

    How to develop a java program that can compare answers to the list of correct answers and output how many were correct

    Example of output should be something like: Andrew 1 correct answer, Mike 0 correct answers, Bryan 3 correct answers.

    Any help would be appreciated

  • #2
    New Coder
    Join Date
    Aug 2009
    Location
    Cochin,India
    Posts
    39
    Thanks
    2
    Thanked 1 Time in 1 Post
    You can store it in arrays.
    String[] correctAnswers={"apple","orange","cherry"};

    String[][] masterList={{"cherry","orange","apple"},{"apple","orange","cherry"},{"orange","cherry","apple"}};

    masterList[0] contain Andrew's answers
    masterList[1] contain Bryan's answers etc.

    Now few comparison statements will do the job..

    It seems like a home work ??


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •