CPT206讲解 、Java设计编程辅导
CPT206 Computer Programming for Financial Mathematics:
Coursework Resit Task Speciffcation
Thomas Selig
Set: Monday, 22 July, 2024
Due date: Sunday, 4 August, 2024, 23:59
This is the speciffcation task sheet for the Coursework resit assessment of your CPT206 module.
The task covers all Learning Outcomes, and has a weighting of 100% towards the ffnal grade for
this module. This assignment has two parts: a coding part described in Section 1, and a report
described in Section 2. The submission deadline for this assignment is Sunday, 4 August, 2024,
23:59. Detailed submission instructions are provided in Section 3.
1 Program description (70 marks)
The aim of this coursework is to build a company management system. All the work should be
coded into a single Java NetBeans project, with the class structure and different functionalities
of the program described as follows. All classes should be properly encapsulated, as seen in the
Lectures and Labs throughout the semester. Your project should also contain a Controller class
for testing. You may leave some or all of your test code in the Controller class if you wish when
submitting, but no marks are allocated for this class’s contents in your submission. Instead you
will be asked to describe your testing in the report (see Section 2.2), and marked on that.
1.1 Task class (14 marks)
The company will consist of a number of employees (see Section 1.2, each of which is assigned a
list of tasks. Each task consists of a description, status (not started, in progress, complete), and a
due date. The Task class should have the following methods:
• isOverdue() which indicates if a task is overdue (i.e. if the due date for the task has already
passed);
• extend(period) which extends the due date of the task by the speciffed period;
• updateStatus(newStatus) which updates the task’s status; a task’s status can only be
moved forward (from “not started” to “in progress” or “complete”, or from “in progress”
to “complete”), not backwards (e.g. from “complete” to “not started”).
1.2 Employee class (18 marks)
This class will model the employees of the company. Each employee has an ID number (unique), a
name, a salary (their monthly wage), a performance indicator (see below), and a todo list of tasks
currently assigned to them (see Section 1.1). In the todo list, tasks should be ordered according to
1their due date, with the most urgent tasks placed ffrst. You should choose a suitable data structure
in the Java collection framework for storing these. Leave a comment in your code justifying your
choice. The Employee class should also have methods to add or remove tasks from their todo list,
with the following restrictions. A task cannot be removed if it would leave them with no currently
assigned tasks. The maximum number of tasks an employee can have assigned is 20. Finally,
employees should be able to fflter their todo list to get their overdue tasks.
The performance indicator takes the following possible values: below expectations, meets
expectations, above expectations, and outstanding. These map in order to numbers 0 (for below
expectations) to 3 (for outstanding), which determine the employee’s salary increase rate, as a
percentage point. At the end of each year, an employee’s salary is updated via an updateSalary()
method, which increases their salary accordingly. So if an employee’s current salary is 10, 000 and
their performance above expectations, their salary the following year will be 10, 000 ∗ (1 + 0.02) =
10, 200. By default, when a new employee is hired by the company, their performance indicator is
set to “meets expectations”, and they do not have any tasks assigned.
1.3 TemporaryEmployee class (6 marks)
The company may at times need to hire temporary employees, for example to meet speciffc project
deadlines. Temporary employees have all the features of the standard employees from Section 1.2,
but are on ffxed-term contracts. This means that they store a date indicating when their contract
will expire. Their contract can be extended if necessary via an extendContract(period) method.
1.4 Company class (22 marks)
Finally, your program will contain a Company class to model the company’s operation. The company
should have a (legal) name, a collection of employees, and a remainingSalaryAllowance variable
indicating how much additional money the company currently has to spend on monthly salaries.
You should choose a suitable data structure in the Java collection framework for storing a company’s
employees, leaving a comment in your code justifying your choice. Companies can either be created
with a speciffed collection of employees, or by default with no employees.
The Company class should have the following methods. A number of these operations will effect
the company’s remaining salary allowance (for example ffring an employee frees up their salary
in the allowance). You should consider all these modiffcations carefully, and if any causes the
remaining salary allowance to become negative, the system should throw some form of critical
error.
• A method hire(employee) that hires a new employee, provided the remaining salary allowance
is suffffcient to do so.
• A method for ffring a given employee. An employee can only be ffred if their performance
indicator is “below expectations” and they have at least ffve overdue tasks.
• A method evaluate(employee, indicator) for evaluating an employee’s current performance.
If they have any overdue tasks, their performance indicator can be at best “meets expectations”.
• A method assign(task, employee) that assigns a currently unassigned task to an employee.
• A method assign(task, oldEmployee, newEmployee) that re-assigns a task previously
belonging to oldEmployee to newEmployee.
• Finally, there should be a method updateFinancials() to update the ffnancial situation of
the company, as follows.
2– The method should take a single parameter representing the company’s intake over the
latest period, that can be added to the remaining salary allowance.
– If the company has any temporary employees whose contract has terminated, these
should be removed from the company’s employee collection.
– If the method is called on January 1 (of any year), all current employees have their
salaries adjusted, as speciffed in Section 1.2.
1.5 Code quality (10 marks)
The remaining marks (10) will be awarded for the quality of your code, as covered throughout the
semester in the Lectures and Labs.
• Keep your code neat and tidy; make sure it is properly indented throughout.
• Choose suitable names for variables and methods, respecting standard Java naming conventions.
• Comment your code as needed.
• Split your code into separate methods as appropriate; methods should not be too long.
2 Report (30 marks)
For this part of the assignment, you will write a report detailing how you designed, implemented,
and tested the program described in Section 1. The report should be typed into e.g. a Word
document, and submitted as a PDF (see Section 3 for more details). Where suitable in the report,
you should refer to speciffc lecture slides (or parts of Lab worksheets), e.g. “as seen in Lecture 10,
slides 32-34”.
2.1 OOP features (12 marks)
Over the course of the semester, you have learned a number of OOP features (e.g. encapsulation)
and principles (e.g. single responsibility principle). In your report, you will explain where you
have incorporated these in your design and how you have done so; include a brief deffnition of
the features/principles in question. Be as precise as possible, illustrating with small portions of
code if necessary. Note that not all the features and principles we saw in the lectures need to be
incorporated into your design; your report should only discuss those that are. This section should
be one-and-a-half to two pages in length.
Good example: The Single Responsibility Principle states that every class in the program
should have responsibility over a single functionality of the program; a class should do one thing.
This principle is incorporated into our class design: all the classes have their own, separate, purpose.
For instance, the Company class
1
...
Bad example: Encapsulation and inheritance are two core features of OOP; they are used in
many parts in my program.
1Give a brief description of the purpose of the Company class here.
32.2 Testing description (12 marks)
As covered throughout the Lectures and Lab sessions in this module, testing is an essential part of
writing computer programs. In your report, you will include a description of how you tested the
various parts of the program described in Section 1. You will state clearly what functionalities you
tested, and describe how you tested them, thinking carefully about possible corner cases. You may
include some sample code if you wish. You should test in the Controller class of your project,
using only tools and techniques that we covered in the Lectures and Labs throughout the semester.
For testing, you must NOT use any new or more advanced tools such as JUnit that weren’t taught.
This section should be one-and-a-half to two pages in length (screenshots excluded).
2.3 Improvements (6 marks)
Finally, this program is, by necessity, a simpliffed model. In your critical evaluation document,
you will list two (2) possible improvements to the system. These could be for instance additional
features to be implemented, changes to existing features so that the system is a more accurate
reffection of a real-world system, and so on. Give a brief justiffcation for why these would improve
the system. This part should be no longer than one page in length.
3 Submission instructions
In the dedicated “Resit submission” Assignment activity on the Learning Mall Online, you will need
to submit the following two (2) documents. The submission deadline is: Sunday, 4 August,
2024, 23:59.
• A single ZIP archive of your entire NetBeans project. Include all the resources your
project needs to run. This ffle will be named “CPT206_Resit_Project_StudentId.zip”.
• Your report from Section 2, typed into e.g. a Word document, and converted into a PDF
ffle. This ffle will be named “CPT206_Resit_Report_StudentId.pdf”.
This assignment is individual work. Plagiarism (e.g. copying materials from other sources
without proper acknowledgement) is a serious academic offence. Plagiarism and collusion will not
be tolerated and will be dealt with in accordance with the University Code of Practice on Academic
Integrity. Submitting work created by others, whether paid for or not, is a serious offence, and
will be prosecuted vigorously. The use of generative AI for content generation is not permitted
on this assignment. Such a use would be considered in breach of the University Code of Practice
on Academic Integrity, and dealt with accordingly. Individual students may be invited to explain
parts of their code in person during a dedicated interview session, and if they fail to demonstrate
an understanding of the code, no credit will be given for that part of the code.
Late submissions. The standard University policy on late submissions will apply: 5% of
the total marks available for the component shall be deducted from the assessment mark for each
working day after the submission date, up to a maximum of ffve working days, so long as this does
not reduce the mark below the pass mark (40%); submissions more than ffve working days late will
not be accepted.
Good luck!
4