Question: Using Java to create a simple test. there will be two class. first class call question, it has two method: string getQuestion and boolean correctOrNot(String

Using Java to create a simple test. there will be two class.

first class call question, it has two method: string getQuestion and boolean correctOrNot(String studentAnswer) return ture if the answer is correct(String studentAnswer.

second class call test, it has three method: ArrayList getQuestions() (will return an array of question), int getAnswers ( string answers) will report the number of student answer the question correct. boolean setQuestion(int index, Question question) will store question in centain position. true if it can store up to 25 question, otherwise false.

So it will using ArrayList, and output all the question in the array, and aske user for the answer. all the answer will follow by order. finally, it will output true answer and number of time that user get correct anwer.

if you have

Test. setQuestion ( 0 , new Question ( "What is 1+1" , "2" ) ) ;

Test. setQuestion ( 1, new Question ( "What is 1+2" , "3" ) ) ;

output will be :

what is 1+1?

what is 1+2?

after the output user should allow inout the answer:

1

3

gradeAnsers({ 1 3} = 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!