Sample Alternative Exam Coursework
Sample Alternative Exam Coursework
Q.1 (a) With reference to the outline class definition in Appendix A explain
the purpose and identify an example of:
(b) With reference to the model class diagram in Appendix B explain the
meaning of each of the following symbols and how they are specified
in Java:
(i) - [2]
(ii) # [2]
(c) With reference to the model class diagram in Appendix B identify the
type of the association between the Cricketer & Bowler classes and
explain how Java would implement it. [2]
Q.2 (a) With reference to the model class diagram in Appendix B, write the
content of a sample text file using the data supplied in Appendix B,
justifying your format. [5]
(b) With reference to the model class diagram in Appendix B explain the
required amendments to the model classes with respect to file
persistence:
(b) Describe how and explain why the Cricketer class illustrated in
Appendix A and B might:
Q.4 (a) Explain the concept of modular design with respect to the principles of
Coupling and Cohesion. [5]
(b) Explain the purpose of Javadoc and NetBeans support for it. [5]
Appendix A
Outline Class Definition
public Cricketer() {
this.id = ++lastAllocatedId;
this.cricketerName = "TBC";
this.totalRuns = 0;
this.battingAverage = 0.0f;
}
Appendix B
Class Diagram
Sample Data
Id Cricketer Name Total Runs Batting Average Total Wickets Bowling Average
1 Mike Denness 1667 39.69 N/A N/A
2 Douglas Jardine 1296 48.00 N/A N/A
3 Ian Peebles 98 10.88 45 30.91
Appendix C
public void load(String filename) {
try{
FileInputStream fin = new FileInputStream(filename);
try (ObjectInputStream ois = new ObjectInputStream(fin)) {
cricketerList = (ArrayList<Cricketer>) ois.readObject();
}
}catch(IOException | ClassNotFoundException ex){
System.out.println(ex);
System.exit(0);
}
}
END OF APPENDICES