Assignment No. 05
SEMESTER Spring 2013
CS304- Object Oriented Programming
Total Marks: 20
Due Date: 05/07/2013
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
The assignment is submitted after due date.
The submitted assignment is other than .cpp file.
The submitted assignment does NOT open or file is corrupted.
The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
For clarity and simplicity, you are required to Upload/Submit only .CPP file
Objective
The objective of this assignment is:
To give you the idea of practical implementation of concepts inheritance and polymorphism.
For any query about the assignment, contact at
CS304@vu.edu.pk
GOOD LUCK
Marks: 20
Consider the following Class Diagram; detailed description of the diagram is given in the table.
Class Name
Attribute Name
Attribute Data Type
Behavior (Functions)
Voter
Password
Character String
-Default Constructor()
-Login _data()
-Cast_vote()
CNIC_No
Integer
Disable
-Cast_vote()
Overseas
-Cast_vote()
In given class diagram, voter is a base class; while Disable and Overseas is its derived classes sharing its all attributes and functions.
You are required to implement the above class diagram in C++. For this you have to use the concept of inheritance and polymorphism. In order to cast vote, your program should be able to produce different interfaces for each category of voter e.g. interface for disable voter should be different from the interface of overseas voter.
Solution Guidelines:
Make Voter base/parent class and inherit classes Disable and Overseas from it.
In voter class:
Make Cast_vote ( ) function a pure virtual function.
Login_data() should be a non-virtual function.
In Disable class:
Make Cast_vote() a virtual function.
Login_data( ) function of disable class should generate an interface that would help disable voters to cast their vote easily. In the body of this function, you also have to call Login_data() function of Voter.
In Overseas class:
Make Cast_vote() a virtual function.
Cast_vote() function of overseas class should generate an interface that would help overseas voters to cast their vote easily. In the body of this function, you also have to call Login_data() function of Voter.
Sample Output:
Lectures Covered: This assignment covers Lecture # 22-31
Deadline: Your assignment must be uploaded/submitted at or before. 5th July , 2013
For Futher Details Visits:-
http://grandstudy.com/showthread.php?6373-CS304-Object-Oriented-Programming-Assignment-No.-05-Fall-Spring-2013-Date-05-07-2013
0 comments: