CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   Java Program which can compare results to a master list. Expert programmer! (http://www.codingforums.com/showthread.php?t=206478)

connollyc4 10-07-2010 05:01 PM

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

sujithpr 10-08-2010 07:04 AM

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.. :thumbsup:

It seems like a home work ??


All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.