Subject: Visual Programming. Class: BTN 5/6/7 Instructor: Mr. Fuzel Jamil
Subject: Visual Programming. Class: BTN 5/6/7 Instructor: Mr. Fuzel Jamil
Assignment Number 2
Subject: Visual Programming. Class: BTN 5/6/7
Instructor: Mr. Fuzel Jamil Submission Deadline 4 May 2016
Plagiarised Code and Assignments received after due date will not be graded!!!!
In this assignment, you are going to create a simple console application that simulates an
electronic messaging system, whereby messages can be sent using either as text message
or email. You will design four classes named Message, TextMessage, EmailMessage and
Test. Additionally, you will develop an Interface named IEquals containing a method
IsEqual(Object o).
The Message is an abstract class containing the general properties and functionalities of
any message. Properties will include Sender, Receiver, messageContent and limit.
Furthermore two abstract methods sendMessage, checkValidity will also be included.
The inheriting classes TextMessage and EmailMessage will provide the implementations
of all abstract portions and also implement the required interface.
Both these classes will implement a method SendMessage simulating the sending of a
message by simply displaying a string on the console showing the sender, message
contents and receiver.
The checkValidity method for the TextMessage will simply check if content length does
not exceed the limit and the sender and receiver’s numbers are valid. The numbers will be
stored as a string, so ensure the number matches the numberLength property and does not
contain any characters.
The checkValidity method for the EmailMessage will simply check if content length does
not exceed the limit and the sender and receiver’s email are valid. The email will be
stored as a string, so ensure the number matches the EmailLength property and does not
contain any numbers. Furthermore ensure the character @ is present in both sender and
receiver.
Funtionality:
Constructors: default and parameterised.
A method void sendMessage( )
A method bool checkValidity( )
The methods will be abstract.
The concrete Class TextMessage will inherit Message, implement the interface IEquals
and also contain the following:
Properties:
numLength (int): indicating the sender or receiver phone Number’s required length
Funtionality:
Constructors: default and parameterised.
Implementations of sendMessage
checkValidity
isEquals
The concrete Class EmailMessage will inherit Message, implement the interface IEquals
and also contain the following:
Properties:
mailLength (int): indicating the sender or receiver email’s required length
Funtionality:
Constructors: default and parameterised.
Implementations of sendMessage
checkValidity
isEquals
Furthermore Design a Test class containing the main method, whereby initializing both
the TextMessage and EmailMessage object and calling all three messages and displaying
their results on the console.