Consider Candidate class from E-Voting System discussed in Assignment No. 01. Class Details are given as follows:
Class Name
|
Attribute Name
|
Attribute Data Type
|
Functions
|
Candidate
|
CNIC
|
Integer/Character String
|
-Default constructor()
|
First_Name
|
Character String
|
-Function to overload stream extraction operator ( >>)
| |
Last_Name
|
Character String
|
- Function to overload stream insertion operator ()
| |
Sign_Alloted
|
Character String
|
-Function to overload comparison operator (= = )
|
Write a Program in C++ that implements the candidate class with given attributes and functions. Your program should be able to do the following:
- There should be a default constructor to initialize data members of candidate class.
- There should be a function to overload stream extraction operator so that we should take input for each object data members directly from main function using cin statement e.g. cin>>Candidate1.
Note: Make sure you take input against each data member specified in above table.
- While inputting, you also have to check for duplicate records i.e. information of a single candidate should not be entered more than one. For this, you have to overload “= =” operator so that comparison operation would be performed on objects directly in main( ) function by writing this type of statement C1= = C2.
- There should be a function to overload stream insertion operator so that we should display each object data directly from main function using cout statement e.g. . coutCandidate1.
- In main() function, you are required to create an array of objects to store candidates information. For example if you want to register data of 5 candidates, you should create an array of 5 objects.
Sample Output:
For sample output look the attached animated GIF file.
Lectures Covered: This assignment covers Lecture # 16-21
Deadline: Your assignment must be uploaded/submitted at or before. June 21, 2013
|
No comments:
Post a Comment