subject

Hello - i have a java program with a class that i'm currently stuck on. i would appreciate any .
below is the pseudocode for my program:
constants:
block_size set to 3. this variable represents the size of an array and the size it increases by each time it is resized.
instance variables:
an array that stores candidates
an integer that stores the actual number of elements that are populated in the candidate array
an array that stores strings that represent each of the offices represented
an integer value that stores the actual number of elements that are populated in the offices array
methods:
constructor: set a default constructor that does the following:
instantiates the two arrays to block_size.
sets the two size variables to 0.
getters for the two sizes
tostring: this method should call the candidate tostring for each item in the array
hascandidate: this method accepts a candidate and using a for loop, searches the candidate array for the received candidate. if the candidate is found, return true. otherwise, return false.
iscandidatesfull: this method returns true if the size of the array matches the length of the array. otherwise, it returns false.
isofficefull: this method returns true if the size of the array matches the length of the array. otherwise, it returns false.
addcandidate(): this method will prompt and accept user input to get the information needed to create a candidate.
it will use the hascandidate method to ensure that a candidate is not on the list before being added to the list. if candidate is already on the list, return a message that reads, "candidate already on ballot."
if candidate is not on the list, then call the overloaded addcandidate method and pass in the candidate to be added.
addcandidate(candidate c): this private method accepts the candidate that will be added to the array.
first you must verify that the list is not full. if it is full, then you call the resizecandidate method.
create a new instance of candidate and add it to the candidates array.
determine whether this is a new office by searching the office array for a match. if no match (or array is empty), add the office to the office array, but you must first determine if the array is full, and if so, resize it.
addvotes: this method will prompt the user to enter votes for each candidate.
determinewinner: this method will display a list of offices that currently have candidates and the user will choose which office they want to determine winner for. it will build a menu of offices, from the offices array and display it to the user. it will call the method and will pass the users input to the method.
: this private method accepts user input and will build a temporary array that contains a list of all candidates that are running for the specific office the user has selected.
findhighestvotes: this private method receives the temporary array and the size of the array from method.
if there is only one candidate running for that office, then the candidate must have at least one vote to win.
if there is more than one candidate, then it will search the temp array for the most votes for that office. set the boolean won value for the winning candidate to true.
if the scores are equal, then there is no winner.
displaywinners: this method outputs all candidates who have won their race.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Which of the following kinds of programs displays an online advertisement in a banner or pop-up window on webpages, email, or other internet service? e
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which of the following is not a key player in the sale of travel products?
Answers: 2
question
Computers and Technology, 24.06.2019 07:30
John recently worked on a project about various programming languages. he learned that though procedural language programs are useful, they have disadvantages too. what is a disadvantage of programs written in procedural languages? a. programs do not represent data complexity. b. programs take more time to execute. c. programs are prone to security threats. d. programs do not interface with multiple platforms.
Answers: 3
You know the right answer?
Hello - i have a java program with a class that i'm currently stuck on. i would appreciate any .
Questions
question
Mathematics, 02.02.2020 16:58
question
Mathematics, 02.02.2020 16:58
Questions on the website: 13722361