Professional Documents
Culture Documents
SSK 3101 (Computer Programming II) : Learning Outcomes
SSK 3101 (Computer Programming II) : Learning Outcomes
Lab 6
Learning Outcomes:
Instructions:
1. Find solution to each problem and get help from your instructor whenever you encounter
any problem.
2. Include the following details in your source code:
// Author’s name:
// Matric number:
// Lab Group:
3. Copy or other forms of cheating is forbidden. The faculty has very strong rules about this,
and the penalties may be severe. The standard penalty for the first offence is to award 0
to all parties concerned.
4. This assignment must be shown to the instructor before or at the end of lab session.
Failure to do so will cause lab points to be deducted.
Note: Use meaningful identifiers and appropriate comments, line spacing and indentation.
1
Question
Create a class named NewspaperSubscriber with private fields for a subscriber’s street address
and the subscription rate. Include get and set methods for the subscriber’s street address and
subscription rate. In the same class, include an equals() method that indicates any two
subscribers are equal if they have the same street address.
Construct a method known as PrintDetails(Object o) in the public class. Pass all instances of
SevenDaySubscriber, WeekDaySubscriber, and WeekendSubscriber to PrintDetails method and
invoke their respective toString() method by using the operator “instanceof” and appropriate
casting might be required.
Write an application named Subscribers that accepts subscriber’s requested service type and
street address. The method PrintDetails(Object o) is inclusive in this class.
Sample input:
NewspaperSubscriber sevendays = new SevenDaySubsriber(“Seven day subscriber”,”Taman Seri
Serdang”);
<End of Question>