Sie sind auf Seite 1von 2

Assignment 2

Class Design and Implementation


Read Section 1 to understand the requirements, Section 2 to understand the programming tasks that you
need to carry out and Section 3 to know what you need to submit for assessment.

1. Description utils a2_Sid

In this assignment, you will design and implement a class Gender


Student
named Student that represents university students. The Male
table below lists the attributes of this class and the domain Female
constraints that are associated to these attributes. Note that
Gender is an enum data type that includes two constant Figure 1: Program structure.
values: Male and Female.
Attributes type mutable optional length min max
id Integer F F - 1 -
firstName String T F 50 - -
givenName String T F 50 - -
lastName String T F 30 - -
email String T T 255 - -
address String T F 2000 - -
phone String T F 20 - -
dob String F F 20 - -
gender Gender F F - - -

2. Task requirements
Below are the requirements of the tasks that you must complete for this assignment. Note that your
program will be marked automatically by a program marker, which expects that different related parts
of the same class function correctly. A design failure in one part (e.g. a setter operation for an attribute)
may lead to failures in other parts (e.g. the getter operation for the same attribute).
1. Create a package named a2_Sid as shown in Figure 1, where Sid is your student id. For
example, if your student id is 123456789 then the package name is a2_123456789.
You will need to use this package to store all the Java class(es) that you create for the program.
IMPORTANT:
(a) Failure to name the package as described above will result in an invalid program.
(b) You must use the necessary utility classes in the utils package (provided as part of the

PR2 Page 1 of 2 Spring 2019


lecture resources). This package must not be created as a sub-package of your package (e.g.
it can be created as another top-level package as shown in Figure 1). In addition, you must
not include package utils as part of your submission.
2. Implement enum Gender as described in Figure 1.
3. Specify and implement class Student.
Note:
(a) the specifications must follow the guidelines and format discussed in the lectures. In
particular, you must use suitable design annotations for this class.
(b) you must use the enum Gender.
(c) you must make the repOK method public.
(d) you can create a test class with a main method to test your class. However, you must keep
this test class in a separate package and you must not submit the test class.

3. Submission requirements
Create a zip-compressed file containing just the folder of the package specified in Task 1. You must
name the file as follows: a2_Sid.zip, where Sid is your student id.
Submit your file to the submission box named “A2”.
IMPORTANT: Failure to name the file as described above will result in an invalid program. In
particular, ONLY the ZIP format is accepted. Other formats (e.g. RAR) are NOT accepted.

PR2 Page 2 of 2 Spring 2019

Das könnte Ihnen auch gefallen