Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create this project package. Have Candidate class a seperate file within the package. Much appreciated!! in Java :D 1. Create a project called week5lab with
Create this project package. Have Candidate class a seperate file within the package. Much appreciated!! in Java :D
1. Create a project called week5lab with a main class AbstractElection. 2. (10) In this problem you will create a class called Candidate which will be placed in a file different from that containing the main class but within the same package. A candidate object will have the following private instance variables. e id. Which will be an int and should also be declared final. e numberOfVotes. Which will be a non-negative integer. This should be set to 0 A candidate will have the following public methods. e Candidate which will take an int as argument and set the candi- getId. This method takes no arguments and returns the candidates e get Votes. This method takes no arguments and returns the number e addVote. This method also takes no arguments and simply adds toString. This overrides the method found in class Object. This date's id equal to this. id. of votes that the candidate has gotten. one to the candidates vote total. should return a string which is the id and the number of votes sepa- rated by a comma. 3. (10) Declare the main class to be abstract. The AbstractElection class will have one protected instance variable called candidates and is of type ArrayListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started