CASE STUDY^503
Scenarios:What are the responsibilities of the AnswerSheetclass? The class must create
instances of itself, input a name and a sequence of T’s and F’s from a file, and compare
two AnswerSheetobjects (the key and a student’s answer sheet) to find the number of
matching answers. There must also be a knowledge responsibility to return the name
on the answer sheet. There is no need for a knowledge responsibility to return the
sequence of T’s and F’s.
At this stage you should step back and see if anything is missing from the design.
You notice that the sample data provided by your teacher has 15 questions. The test
you took last week had 20 questions. Because the number of questions varies, the num-
ber of questions on the exam must be input to the constructor for the class AnswerSheet
to determine the number of T’s and F’s.
CRC Cards:
Class Name: AnswerSheet Superclass: Object Subclasses:
Responsibilities Collaborations
Create itself (numQuestions)
Input name and answers BufferedReader
Compare with another answer sheet
return int
None
None
Know the name
return String
None
input file
output file
answer sheet
application class