Released: 27 September 2019 Submission Deadline

You might also like

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

Tugas5/11S2110-PBO-1920

Released: 27 September 2019

Submission Deadline: 29 September 2019, at 21.00

Submission Detail:
1. Assignment Report: LaporanTugas5_NIM.docx (a class diagram from assignment
number 1 or number 2).
2. Program_Tgs5_NIM.rar consists of:
a. AddressPage_NIM.java
b. AddressPageTestDrive_NIM.java
c. [optional] AddressBook_NIM.java
d. [optional] AddressBookTestDrive_NIM.java

Submission link : https://ecourse.del.ac.id/mod/assign/view.php?id=7933

Tugas 5 (Week 3):

1. Address Book
a. Of course you know address book, people use it to record some information about
other people they know. Address book consists of several pages which have the
identical format.
In this assignment you will write a class that represents a page in the address
book. You named the class “AddressPage_NIM” and here are the attributes and
the methods:

Attributes:

- name : String (private)


- address: String (private)
- phone: int (private)
- email: String (private)
- nbInstance: int (private static)

Methods:

- 4 setter
- 4 getter plus one getter: getNbInstance():public static. Return
nbInstance (hold information about number of instances/object that have
been created).
- toString():public. Return string that holds information about the object.

Tugas5/Week3 S1IF/11S2110-PBO/1920 Hal. 1 dari 2


Tugas5/11S2110-PBO-1920

- matches (AddressPage A1, AddressPage A2): public static . Compare


A1 with A2, return 1 for match and 0 for not match. Two objects is match if
every attributes in one object hold same information with the other one.
- matches (AddressPage A): public. Compare this with object A, return 1 for
match and 0 for not match. Two objects is match if every attributes in one
object hold same information with the other one.
i Write a class named AddressPage_NIM, follow the description given
above.
ii Then write a driver class named AddressPageTestDrive_NIM, inside
this class, make four objects of theAddressPage. One of them is
initializing through a constructor without parameter. And there is one
object that creates using copy constructor.
iii Try to invoke all the methods.
iv Draw a class diagram of AddressPage_NIM class.

b. [Optional] You have finished your class AddressPage_NIM. Next you will use it
to make other class “AddressBook_NIM”.

Attributes:

- addressPages: array of AddressPages_NIM, can hold maximum 5 elements.


- nbElement: int. Number of element in array addressPages_NIM.
- MAX_ELEMENT: final int. Assign it with 5.

Methods:

- addElement(AddressPage A): int. Add one new element only if nbElement


< MAX_ELEMENT. Return 1 if success and 0 if not success.
- getElement(int idx): AddressPage. Return one element from index idx.
Return Null if idx > (nbElement-1) and idx >= 0.
- printAllElement(): print all elements.

i Write a class named AddressBook_NIM, follow the description given


above.
ii Then write a driver class named AddressBookTestDrive_NIM, inside this
class, make six instants of the AddressPage_NIM.
iii Try to invoke all the methods of AddressBook_NIM.
iv Draw a class diagram of AddressPage_NIM class and AddressBook_NIM
class, and also draw a relationship between them.

~~~~~~~~~~~~~~~~~~~~~~~~ End of Assignment 5 ~~~~~~~~~~~~~~~~~~~~

Tugas5/Week3 S1IF/11S2110-PBO/1920 Hal. 2 dari 2

You might also like