CSC8404 - Advanced Programming in Java


Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due


CSC8404 - Advanced Programming in Java
Assessed Coursework

The coursework, described below, involves development of the classes and tests to be used in the development of an application for taking quizzes.

Please check the submission deadline for this coursework on NESS.

1. Aim

The aim of this coursework is to practice the design principles covered in lectures. You will develop interfaces and classes to demonstrate that you have learned and understood modulematerial, including:
• appropriate overriding of Object class methods, including overriding toString and providing a static valueOf method when appropriate
• design of interface-based hierarchies, programming through interfaces and late binding
• the use of factories to control instantiation of objects, including guaranteeing the instantiation of unique instances
• defensive programming including the use of immutability
• the use of appropriate interfaces and classes from the Collections framework
• appropriate use of Javadocs to document your interfaces and classes
• unit testing via JUnit
The coursework is not algorithmically challenging. The focus is on good design and good practice.

The coursework is not about development of an end-user application. You are developing interfaces and classes that could be used for the development of an application. You should not develop a graphical user interface or a command line interface. They are not necessary and you will be given no credit for doing so. You must test all your interfaces and classes using unit tests.

Note: Your solution should correspond to the simplicity of the specification. You risk losing marks if you attempt to provide a solution that is more complicated than necessary.

2. System overview

You have been tasked with implementing a library for generating and taking quizzes for a local school which will be used within a larger application for student assessment.

A student is considered to have passed the assessment if they score 50% or more on a regular quiz. If the student fails two regular quizzes, they are considered to have failed the assessment.

Each student has an option to take up to two revision quizzes unless they have already received a PASS or FAIL verdict. Also, a student should not be able to take another regular quiz if they have received their verdict (e.g., a student who has passed on the first attempt should not be able to take another regular or revision quiz).

Each quiz should contain questions of two different types: free response questions and multiple-choice questions. A regular quiz should be generated randomly from the pool of available questions. A quiz must not have any duplicate questions, and it must contain questions of both types. A revision quiz must contain only questions that the given student has not seen before or answered incorrectly in the past. Similarly to the regular quiz, it must also not have any duplicates, and it must contain questions of both types (but only if there are still unseen or incorrectly answered questions of both types in the question pool).

You can use the following summary of the required high-level methods as a starting point. 

generateQuiz(numberOfQuestions)

This method generates a regular quiz.
revise(student, numberOfQuestions)
This method generates a revision quiz.
takeQuiz(student, questions, answers)
takeRevisionQuiz(student, question, answers)

Each of these methods calculates and returns the score (a number between 0 and 1) indicating the fraction of correct answers given by the student for the given quiz. This method should also provide an appropriate indication if a student is not eligible to take a quiz.

generateStatistics(student)

This method returns a record for each student with their quiz taking statistics: final verdict, quiz scores, number of attempts, number of revisions, etc.

Hint: in order to provide revision capabilities in your system, you will need to keep track of quiz taking statistics by each student (number of quiz and revision attempts, questions that the student answered before, etc.). Use appropriate Java collections to implement the required functionality.

3. Implementation

To complete the quiz generation system outlined in Section 2, you will need to provide interfaces and classes for the functionality described in this section. You must also implement test classes to unit test your solution.

Questions

All questions must have the following functionality:
• A method to get the question formulation.
• A method to check if the given answer is correct.
• You must not provide any methods that could change the question formulation or the correct answer/s.
• You must not provide a method that simply returns the correct answer/s.

The following rules determine whether an answer is correct:

• A free response question must have exactly one correct answer.
• A correct answer to a multiple-choice question can consist of multiple options. For example, consider a question with 4 options “a,b,c,d”, where the correct answer is “b,c”. In this case both options must be provided for the answer to be correct. For instance, answers like “b”, “c”, or “a,b,c” should be considered incorrect.

The following rules apply to the answers:

• All answers must be case insensitive. For example, “ANSWER”, “answer”, “AnsWEr”, etc. should be treated as the same answer. Similarly, “A,b,C”, “a,B,c”, “a,b,c”, etc. will represent the same answer.
• All answers should ignore leading and trailing whitespaces. For example, “My answer” and “ My answer ” should be treated as the same answer.
• Answers for free response questions must treat multiple joint whitespaces as a single whitespace. For example, “ My answer ”, “mY AnSWEr ” and “My answer” should be treated as the same answer.
• Answers for a multiple-choice question must be separated by a comma (“,”).
• For multiple-choice questions, the order in which answer options are provided must not matter. For example, if “a,b,c” is a correct answer to a question, then “b,c,a”, “c,a,b”, “c,b,a” etc. are also correct.
Further requirements:
• Each multiple-choice question must have from 2 to 4 possible answer options.
Available questions:
• You can assume that a database of questions already exists, and you do not need to perform reading and writing from/to the database. You can statically initialise a collection of 10-15 questions that you will treat as the pool of questions for testing purposes. However, you must provide methods for creating question instances of the correct type from text.

• You must provide an appropriate inheritance hierarchy for questions.

Students

• A student has a name and a date of birth.
• A name consists of the first name and last name of a student.
• For simplicity, you must use java.util.Date for the date of birth. You must not use deprecated methods of the Date class. So, in your test classes, you should use java.util.Calendar to construct a date of birth. You can assume default time zone and locale.
• You must provide methods to access a student's name and date of birth.
• Two students are considered to be the same if they have the same name and the same date of birth.
Statistics
• The statistics record for each student must contain:
o final verdict (PASS, FAIL or TBD),
o number of attempts,
o number of revisions,
o scores for each quiz attempt and revision attempt.
• You must provide methods for accessing the student’s information and each of the fields above.

4. Deliverables

Your solution should include your interfaces and classes that comprise the implementation of the system and types outlined in Sections 2 and 3. You must annotate your code with appropriate Javadocs. In addition, you should provide separate unit test classes that demonstrate thorough testing of your solution.

Also, write a document (MS Word, or PDF) that explains the structure of your overall design. This document should have a picture containing UML diagrams of all your classes and interfaces and their relationships depicted by annotated arrows (extends, implements, uses). For each class and interface, the UML diagram should show the class/interface name, fields and methods (where appropriate). Also, each diagram should indicate whether it is a class, abstract class or an interface.

You must submit your solution through NESS as a single zip archive that contains your Java source code files and your document.

Please check the submission deadline for this coursework on NESS.

5. Assessment & mark allocation

Marks will be allocated for:

• Overall structure (e.g. interfaces, classes and their relationships), 20%

• Correct implementation of rules specified in Sections 2 and 3, as well as for choice and use of maps and collections, 35%.

• Following good practice guidance: maintenance of invariants and defensive programming, use of immutability, appropriate overriding of Object methods, use of Javadoc comments, 25%.
• Evidence of testing by implementation of appropriate test classes that test the normal case, boundary conditions, and exceptional cases. 20%.

6. Style guidelines

Adopt a consistent style, do not violate naming conventions (when to use upper/lower case letters in names) and make appropriate use of whitespace (indentation and other spacing).

7. Further notes and hints

Break the coursework down into separate tasks. Start with the simpler classes first (e.g. for students, statistics, etc.). Unit test classes as you work through the coursework.

For each class you implement you should consider:

1. whether to override Object methods (equals, toString etc.),
2. whether to use an interface-based hierarchy, and
3. whether the class should be immutable.

For any questions, please make full use of the practical classes. For any clarifications, you can also email:

[email protected]

[email protected]

发表评论

电子邮件地址不会被公开。 必填项已用*标注