Monday, August 22, 2011

ICT 203 - Q1c

I would check the location of the associate member within the subscribeMagazine method in the Associate subclass to determine if the Associate Member is eligible to subscribe for the magazine. If the member is eligible to subscribe for the magazine, within the subscribeMagazine method, it will check to see if the member wants to subscribe for the magazine. If the member is eligible and wants to subscribe to the magazine, the value of the variable subscribeMagazine (true) is returned, else false will be returned. The value of the variable subscribeMagazine returned will be used in the computeFee method. If the value of variable subscribeMagazine is true, the additonalFee variable will be added in the calculation of the totalFee, else the additionalFee will not be added to the totalFee.

Question

ICT 203 - Q1b ( Foundations in Modern System Design)










Question

ICT 203 - Q1a ( Foundations in Modern System Design)

Classes involved would be the superclass called Membership, and the subclasses Ordinary and Associate. The superclass Membership would be an abstract class with its common (generic) attributes such as memberName, address and totalFee, and methods such as computeFee(), which would be inherited and reused by the Ordinary and Associate subclasses. Thus, the Ordinary and Associate subclasses have a “is a” relationship with its superclass Membership.

Question

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:

Saturday, August 20, 2011

Manhwa: Cutie Boy by Hwang Mi-ri


Cutie Boy is another of Hwang Mi-ri’s creations spanning 8 volumes. The story revolves around Lee Han-Ah, a girl who happens to be the leader of her high school gang and her mishaps at her attempts to look for a pretty boyfriend.

When Han-Ah was in grade school, she was bullied by a boy called Yoo-Min. Yoo-Min had made fun of her and commented that she had a “wide and flat” butt; it left a scar in her heart, not knowing that it was actually Yoo-Min’s method of expressing his affection. Now in high school, Han-Ah has become the leader of the gang at her school. Although she is not a talented fighter, she wins fights by using the ‘innocent’ girl act. Although she is not that enthusiastic about her new role, her friends push her to do so as she is seen as their only hope. As her school is an all-girls school, the girls were once bullied by the boys from a nearby boy’s school, until Han-Ah became the captain and started to win fights.

On day, Han-Ah meets Yoo-Min on the streets and starts dating him without knowing that he is the same Yoo-Min that had bullied her in grade school. She soon finds out that his true identity and becomes scared of him. However, after a series of encounters with Yoo Min, she begins to realize that he truly cares for her. During the exams terms Yoo-Min takes her to meet his family, and his grandmother tells him she won’t allow him to be with Han-Ah because her narrow hip is not suitable for bearing children (the root of all the tormenting). They start going out again but due to some misunderstanding, Han-Ah becomes Mi Yoo’s ‘girlfriend’, because he realizes she is his ideal type of woman...Read More>>

Saturday, July 30, 2011

Fake Contact Lenses

Counterfeit products are no longer limited to health products, IT gadgets and branded goods, now even contact lenses are not spared. What is scary is that it is legitimate shops knowingly selling such products.

In recent years, in an attempt to cut costs and earn more profit, people have devised ingenious yet harmful products. From highly sought after IT gadgets (i.e. Apple iPhone), branded goods, all the way down to daily necessities (i.e. milk, eggs) and children’s toys. There’s just about a counterfeit for almost everything available in the (black) market.

Now there are even counterfeit contact lenses, which are harmful to the eyes. For the first time in Singapore, the Health Sciences Authority (HSA) has confiscated over 100 boxes of counterfeit colored contact lenses from legitimate suppliers, such as licensed optical shops. The confiscated boxes of counterfeit lenses were obtained after raiding five optical shops across the island. Currently, more than 10 people are also being questioned in connection to the case.

It was reported that the counterfeit contact lenses were fraudulently labeled as “FreshLook ColorBlends” Contact Lenses from CIBA VISION. These counterfeits were found to be unsafe and of poor quality: the solution in which the lenses are packed were tested and determined to have been contaminated with Pseudomonas aeruginosa, a harmful bacteria known to cause serious eye infections. The packaging for the counterfeits looks almost authentic, apart from typographical errors on the packaging. A closer look on how to spot the counterfeits here

To date, the Health Sciences Authority (HSA) has reported that one anonymous consumer, who is in her 30s, removed the lenses immediately when she could not close her eyes after wearing them.

According to CIBA VISION, this is...Read more >>

Smile, Honey

Smile, Honey is a family Korean drama that revolves around 2 families and their interactions. First, there is the Suh family, who owe their riches and prestige to the now-deceased CEO/father/grandfather. There are 5 members in the Suh family: Suh Jung-gil who is the head of the family, his wife Ju-hee, Sung joon the eldest son who went to U.S. to become a pro golfer, Jung-Kyung the second child in the family and Jung-in, the youngest daughter.

Jung-gil is a snobbish man and looks down on people who have no money, his wife is more of an air-head that only cares about her nails and feels faint at the slightest sign of trouble of hardwork.

Bascially, the whole Suh family, except for Jung-kyung are snotty and out of touch with reality. Jung-kyung is the only one in her family that is rational. However, she is a little too rational and practical; that it would seem that she lacks emotion: she’s cool, professional, and detached. Her attitude causes strain to her relationship with her younger sister Jung-in. Jung-kyung chooses to focus on her career and at the start of the show, interacts or spends very little time with her family, preferring to stay at the hospital than go home. She does not think too highly of her younger sister who is the princess of the family and only dreams about getting married into a good rich family.

Then there is the Kang family. Kang Man-bok (Grandpd Kang) has been the driver to the Suh family since Jung-gil’s father’s time. Jung-gil is rude to Man-bok and disrespectful to him; he even fires Man-bok one morning because he felt that Man-bok was nagging too much. Gandpa Kang is not necessarily the lead character but certainly the central one who holds the rest together...Read more>>