Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PART-A You are asked to write a Primary Election Computerized Ballot Program using Object Oriented Programming. Write a class named Voter with data attributes for

PART-AYou are asked to write a Primary Election Computerized Ballot Program using Object Oriented Programming. Write a class named Voter with data attributes for A person's firstname; A persons lastname; A persons ID number; A Boolean data attribute indicating whether the voter is in favor of or opposed to Proposition A. Include a voter Subclass called Democrat with the data attributes: Boolean data attribute indicating if the voter is in favor of Candidate B; Boolean data attribute indicating if the voter is in favor of Candidate C. Include a voter Subclass called Republican with the data attributes: Boolean data attribute indicating if the voter is in favor of Candidate D. Note that Independent Voters will belong to the Voter Class and will only be able to vote on Proposition A, While Democratic Voters will belong to subclass Democrat and will not only be able to vote on Proposition A, but also on Candidates B and C. And Republican Voters will belong to subclass Republican and will not only be able to vote on Proposition A, but also on Candidate D. You will need to call this program: voter.py, but it should have your name in the module. PARTB: The program will then ask you for your ID number. Then the program will ask you whether you are for or against Proposition A. After that it asks you if you are an: I (Independent); or R (Republican); or D (Democrat);. If you answer I, then no further questions are asked and all the attributes of the SuperClass Voter, to which you belong, are printed to screen. If you had typed in R, then you are asked to answer the additional questions: Whether you are for or against proposition A. Whether you are for Candidate D. You then print to screen all the attributes of the Republican Subclass to which you belong. If you had typed in D, then you are asked to answer the additional questions: Whether you are for Candidate B. Whether you are for Candidate C. A check should be done to be sure that you have not voted for Both Candidate B and Candidate C. You then print to screen all the attributes of the Democrat Subclass to which you belong. My-Mod: Voter.py class Voter: def __init__(self,ID,fname,lname,propA): self.__ID = ID self.__fname = fname self.__lname = lname self.__propA = propA def set_ID(self, ID): self.__ID = ID def set_fname(self,fname): self.__fname = fname def set_lname(self,lname): self.__lname = lname def set_propA(self,propA): self.__propA = propA def get_ID(self): return self.__ID def get_fname(self): return self.__fname def get_lname(self): return self.__lname def get_propA(self): return self.__propA class Democrat(Voter): def __init__(self,ID,fname,lname,propA,candidateB, candidateC): Voter.__init__(self, ID,fname,lname, party, propA) self.__candB = candidateB self.__candC = candidateC def set_candB(self, candidateB0): self.__candB = candidateB def set_candC(self, candidateC): self.__candC = candidateC def get_candB(self): return self.__candB def get_candC(self): return self.__candC class Republican(Voter): def __init__(self,ID,fname,lname,propA,candidateD): self.__candD = candidateD def set_candD(self,candidateD): self.__candD = candidateD def get_candD(self): return self.__candD

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago