Page 1 of 1

Do not use break or continue in your loops. Do not use global variables. Parameters must be passed to methods. The only

Posted: Thu Jul 14, 2022 2:17 pm
by answerhappygod
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 1
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 1 (89.4 KiB) Viewed 44 times
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 2
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 2 (68.02 KiB) Viewed 44 times
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 3
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 3 (223.65 KiB) Viewed 44 times
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 4
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 4 (104.98 KiB) Viewed 44 times
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 5
Do Not Use Break Or Continue In Your Loops Do Not Use Global Variables Parameters Must Be Passed To Methods The Only 5 (113.39 KiB) Viewed 44 times
java
Do not use break or continue in your loops. Do not use global variables. Parameters must be passed to methods. The only global variable allowed would be the definition of the Scanner class, or in very specific situations as strictly required by the program requirements. Choose descriptive method names. Avoid using method names such as method 1 , method 2 , etc. Do not use System.exit() method
Show only 2 digits after the decimal point for the percentage of votes and the average votes. The number of votes must be a whole number. Display the number of votes without any digits after the decimal point. Show the % symbol after the percentage of votes as shown in the sample run.
1. Write a method to ask the user for the number of candidates and return the value. Make sure the user enters a number between 1 and 50 for number of candidates. 2. Write a method to ask for the last names of a series of candidates and the number of votes received by each candidate. The method must be able to pass the needed arrays. Note the method will have input statements. Iint: Array names are passed by reference. This function will not return a value. 3. Write a method to accept number of votes and number of candidates and return the percentage of votes. Hint: This function returns the array of percentage values. 4. Write a method to display each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate in a tabular format. Note that this method does not calculate anything. It just displays data. 5. Write a method to return the name of the loser. 6. Write a method to return the average of the number of votes casted. 7. Write a method that accepts as parameter the name of a candidate and return the number of votes received by the candidate. If the given name does not exist, return −999, so you can use it in your main method to display an error message. Allow the user to search as many times as he or she wishes. The search must be case insensitive.
Sample interaction: Note that your output should be similar to this interaction. enter the number of candidates −1 enter the number of candidates 55 enter the number of candidates 3 Enter candidate's last name: Foo Enter votes received by the candidate 5000 Enter candidate's last name: duck Enter votes received by the candidate 6000 Enter candidate's last name: bar Enter votes received by the candidate 4000
I he loser is bar The average number of votes is: 5000.00 Enter a name of the candidate to search for - enter DONE when you are done: duck duck received 6000 votes Enter a name of the candidate to search for - enter DONE when you are done: BAR BAR received 4000 votes Enter a name of the candidate to search for - enter DONE when you are done: me me is not a candidate! Enter a name of the candidate to search for - enter DONE when you are done: DONE