Monday, August 22, 2011

ICT203 - Foundations in Modern System Design Question 1

An employees’ union has two types of membership: ordinary and associate. Ordinary members pay $108 per year and receive a free monthly magazine. Associate members pay $72 per year, but they do not receive the magazine unless they pay an additional charge of $12 per year. Every  member gets a 50% discount off the membership fee, if he is stationed overseas; however, this discount is not applicable to the magazine charge for the associate member as the union does not send the magazine to associate members overseas.
(a) Identify the classes involved and explain the superclass-superclass relationship among  them. (answer)

(b) Draw a UML class diagram to depict the given information, showing the attributes for each  class, and the class hierarchy. (answer)

(c) Explain how you would record the fact that an associate member needs to pay for the  magazine. State also the class or classes concerned, and the attributes and/or methods added. (answer)

(d) Write Java code to define the classes and hierarchy you had identified above. In each class, include the attributes as instance variables of suitable data types, and appropriate  constructor(s) that initialize(s) the instance variables. Note that each subclass should have  its own implementation of the computeFee() method. (answer)

(e) (i) Explain how you might write the computeFee() method for the superclass.

(ii) What is the advantage of having this method in the superclass?

Related Posts:

No comments:

Post a Comment