Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

public class Voters private String VoterID private String VoterName private int ag... 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_2

Step: 3

blur-text-image_3

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

Federal Taxation 2016 Comprehensive

Authors: Thomas R. Pope, Timothy J. Rupert, Kenneth E. Anderson

29th Edition

134104374, 978-0134104379

More Books

Students also viewed these Computer Engineering questions