Question: Design a Java console application to conduct Elections. . Define a class Candidatess with members for CanID, CanName and Votes. Define a class Voters class

Design a Java console application to conduct Elections. . Define a class Candidatess with members for CanID, CanName and Votes. Define a class Voters class with VoterID, VoterName and age. Create a class called Election comprising of list of Candidates and list of Voters. Define a member function called Vote() to which a voter id and candidate id are passed as arguments. Verify whether the voter id is present in the Voters object array and the age is not less than 18. Then verify that the candidate id is present in the Candidates list. If so, increment the Votes member variable of the corresponding Candidate object in the list. Provide another method called declareResults in which count the no of votes recorded for each candidate and display the name of the candidate as the winner. In main, create an object for Election with 3 candidates and 10 voters. Assign some initial values for candidates and voters. Design a menu driven application with the following options. 1. Vote for candidate and 2. Declare Result. Handle the exceptions wherever needed.

Step by Step Solution

3.46 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class Voters private String VoterID private String VoterName private int ag... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Engineering Questions!