Lab1

advertisement
DEPARTMENT APPLIED COMPUTER SCIENCE
FUNDAMENTALS OF JAVA PROGRAMMING 2 (ACS 1904)
LAB PRACTICE 1 EXERCISE
15/01/2015
Instructions: Please do the questions below. The lab demonstrator is there to assist so please ask him if
you need any help. At the end of the session please email your work to
acs1904winter2016@gmail.com, putting in the subject “Lab practice 1 exercise”. Please make you
submit your work as .java (dot java) files.
Question
Write a program to determine someone's score on a multiple-choice test having 12 questions.
The program has two char arrays: correctAnswers[] and studentAnswers[].
The array correctAnswers holds the correct answers to the test. Use the following for correct
answers: a b c d a b c d a b c d
The student's answers will be provided by the user of the program. These must be stored in the
array studentAnswers[]. After the student answers have been obtained the program must
determine the student's score: the number of questions the student answered correctly.
For example if the student answers are a a a b b b c c c d d d then the score for this student is 4.
Download