0% found this document useful (0 votes)
46 views

Subject: Visual Programming. Class: BTN 5/6/7 Instructor: Mr. Fuzel Jamil

The document describes an assignment to create a console application simulating an electronic messaging system. It involves designing four classes: Message, TextMessage, EmailMessage, and Test. Message is an abstract class containing properties and methods for general message functionality. TextMessage and EmailMessage inherit from Message and implement an IEquals interface to compare messages. The assignment details the requirements, properties, and methods for each class.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Subject: Visual Programming. Class: BTN 5/6/7 Instructor: Mr. Fuzel Jamil

The document describes an assignment to create a console application simulating an electronic messaging system. It involves designing four classes: Message, TextMessage, EmailMessage, and Test. Message is an abstract class containing properties and methods for general message functionality. TextMessage and EmailMessage inherit from Message and implement an IEquals interface to compare messages. The assignment details the requirements, properties, and methods for each class.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COMSATS Institute of Information Technology, Abbottabad.

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.

The interface should be implemented by both TextMessage and EmailMessage whereby


providing implementation details for the method isEquals(Object o). This method should
compare the argument provided and the invoking object for equality by checking if the
sender, receiver, and message contents match and return either true or false.
The following are the requirements:

An Abstract Class Message will contain the following:


Properties:
All messages will have a sender. (string)
All messages will have a receiver.(string)
All messages will have a messageContent. (string)
All messages will have a limit on the length of the message. (int)

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.

You might also like