Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**Please read the question carefully and following all the requirements below. I really appreciate** Download and use the class and data files as well as

**Please read the question carefully and following all the requirements below. I really appreciate**

Download and use the class and data files as well as the main driver found in this - http://www.mediafire.com/download/rcu864f0p1v3kbh/Main+Driver.zip

(C++) In the Programming Example Election Results, the object candidateList of the type orderedArrayListType is declared to process the voting data. The operations of inserting a candidates data and updating and retrieving the votes were somewhat complicated. To update the candidates votes, we copied each candidates data from candidateList into a temporary object of the type candidateType, updated the temporary object, and then replaced the candidates data with the temporary object. This is because the data members list is a protected member of candidateList, and each component of list is a private data member.

In this lab, you are to modify the Programming Example Election Results to simplify the accessing of a candidates data as follows:

Derive a class candidateListType from the class orderedArrayListType.

class candidateListType: public orderedArrayListType {

public:

candidateListType(); //default constructor candidateListType(int size); //constructor

void processVotes(string fName, string lName, int region, int votes); //Function to update the number of votes for a //particular candidate for a particular region. //Postcondition: The name of the candidate, the region, //and the number of votes are passed as parameters.

void addVotes(); //Function to find the total number of votes received by //each candidate.

void printResult() const; //Function to output the voting data. };

Because the class candidateListType is derived from the class orderedArrayListType, and list is a protected data member of the class orderedArrayListType (inherited from the class arrayListType), list can be directly accessed by a member of the class candidateListType.

Write the definitions of the member functions of the class candidateListType. Rewrite and run your program using the class candidateListType.

Here is the expected output and layout or link: http://i.imgur.com/R3hItpI.jpg

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago