Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

JAVA

Programming

Nguyn Tun Hng


2013-10-31

Implement the simple classes in le

Assignment 03.pdf
Implement the methods of these class.
Implement a test class.

Following these steps to implement a class


1. Create a class.
2. Declare classs attributes.
3. Generate setter and getter methods for the

attributes.
4. Implement constructors (using setters inside)
i. Full constructor.
ii. Default constructor.

5. Implement other classs methods.


3

Always

using setter and getter when you


want to use the classs attributes.
When nished implementing every method,
make sure it working well.
Always following the blueprint, dont make it
by yourself.

Which attributes of
Course class? (data
type? relationship?)

W h a t i s m o d i e r
a c c e s s o f t h e s e
attributions?

Which methods of
Course class?
5

Which attributes of
Section class? (data
type? relationship?)

W h a t i s m o d i e r
a c c e s s o f t h e s e
attributions?

Which methods of
Section class?
6

In Course class, offered as, a one-to-many

association with the Section class.


And, prerequisite , a many-to-many
reexive association.
In Section class, an unnamed, one-to-many
aggregation with ScheduleOfClasses.
Also, teaches, a one-to-many association
with Professor.
And attends, a many-to-many association
with Student.
7

one-to-many

relationship is the same as


SoftwareHouse relationship with Sta.

Contains a list of B
(can use ArrayList)

0..*

Contains a reference to A

many-to-many relationship

A
Contains a list of B
(can use ArrayList)

*..*

Contains a list of A
(can use ArrayList)

Implement all methods of classes.


If you dont understand methods meaning,

please listen to lecture in laboratory class.


For further information, you can ask me via
portal site.
(http://www.math.hcmus.edu.vn/portal)

10

We are also going to implement a test class

which has a main() method to test the


above classes.
In the main() method, we will create some
objects including courses and sections for
each course. Then, we will call some methods
of each object to test them.

11

Nguyn Tun Hng

THANK YOU
FOR YOUR ATTENTION.

You might also like