The election program illustrates the use of ArrayLists, loops and conditional statements.
ArrayLists are resizable arrays, while loops and conditional statements are used to perform repetitions and make decisions, respectively.
The election program written in Java, where comments are used to explain each line is as follows:
import java.util.*;
public class Main {
public static void main(String[] args) {
//This creates a Scanner object
Scanner input = new Scanner(System.in);
//This creates a string ArrayList for the names of the candidates
ArrayList<String> names = new ArrayList<String>();
//This creates an Integer ArrayList for the vote count of the candidates
ArrayList<Integer> votes = new ArrayList<Integer>();
//This declares name as string
String name;
//This gets input for the name of the candidates
name = input.nextLine();
//This is repeated until the user enters "-1"
while (!"-1".equals(name)){
//If name is in the list,
if(names.contains(name)){
//This gets the index of the name
int pos =names.indexOf(name);
//This calculates the number of votes
Integer value = votes.get(pos)+1;
//This adds the vote to the vote ArrayList
votes.set(pos, value);
}
//If otherwise
else{
//This adds the candidate name to the name ArrayList
names.add(name);
//This adds 1 as the vote of the candidate to the vote ArrayList
votes.add(1);
}
//This gets input for the name of another candidates
name = input.nextLine();
}
//This prints the name of the election winner
System.out.println("Winner : " +names.get(votes.indexOf(Collections.max(votes))));
}
}
Read more about ArrayLists, loops and conditional statements at:
https://brainly.com/question/19504703
WHEN IS THE DESIGN PROCESS FINISHED IN ENGINEERING?
Answer:
I think answers is it never ends
Why there should be laws against using phones and
driving?
Answer:
There should be laws against using phones & driving because you can get into an accident & you are not paying attention to the road & it's surroundings.
Explanation:
It is for your safety & other peoples safety around you.
My sister told me an extremely funny joke. what is the direct object for this sentence ?
Answer:
Explanation:
This type of RAID implementation uses its own Central Processing Unit (CPU) for calculations on an intelligent controller card by:
RAID implementation uses its CPU for calculations on an intelligent controller card by a hardware implementation.
Basically, a hardware implementation refers to a job is done using a physical device or electronic circuit rather than been done automatically by the computer program.
Hence, through a hardware implementation, the RAID implementation is able to use its CPU for calculations on an intelligent controller card
Read more about hardware implementation
brainly.com/question/25803633
Kari needs to change the brightness and contrast on an image she has inserted into a Word document. Which group should she use to do this? Adjust Picture Styles Arrange
Answer:
adjust
Explanation:
it can be found in the top left corner
computer science
describe 3 differences between the checksum and check digit:
Answer:
A check digit, also known as a checksum character, is the number located on the far right side of a bar code. The purpose of a check digit is to verify that the information on the barcode has been entered correctly.
A check digit, even comprehended as a checksum character, stands for the number found on the far right side of a bar code. The intention of a check digit exists to confirm that the information on the barcode contains been documented accurately.
What are the differences between the checksum and check digit?A checksum in public can be any size, although generally, they exist some suitable number of bits for computation, such as 32. The more extensive the checksum, the wider the range of errors it can capture. For instance, the checksum utilized for credit card numbers will notice changed digits that exist after each other, but not reversed digits that exist split by a single digit.
All cryptographic hashes (like MD5, SHA, etc.) can be utilized as checksums, but not all checksums exist cryptographic. CRC-type checksums aren’t cryptographic, but they’re extremely quick to calculate, and so they exist generally utilized for things like hard drive checksums where you don’t require the cryptographic functionality, but you accomplish want to notice an extensive range of probable errors.
To learn more about checksum and check digit
https://brainly.com/question/14789699
#SPJ2
Help!!
So I think that someone is tracking my truck with an apple airtag but I don't know for sure. The only apple product I have is an iPad and I don't know how to check if an airtag is near by!!
Answer:
Explanation:
In iOS 13 or iPadOS 14 or later go to Settings > account name > Find My > Find My iPhone/iPad, and disable Find My network.
In macOS 10.15 Catalina or later, go to the Apple ID preference pane, select the iCloud link at left, click the Options button to the right of the Find My Mac item, and uncheck Offline Finding or Find My network (the text varies by macOS version).
10. What Microsoft program is frequently used to develop pictorial representations
of a database's logical relationships?
A. Visio
B. Access
C. Excel
D. Word
Answer:
A. Visio
It's a "powerful tool for diagramming needs". In other words, pictures.
Can someone plss help me!!
Answer:
HTML elements are delineated by tags, written using angle brackets.
Explanation:
Tags such as <img /> and <input /> directly introduce content into the page.
Within a master slide template, you can create a custom slide layout. Place the steps to complete this task in the correct order.
Answer: yes the above is correct
1. In the slide master tab, select insert layout.
2. Click rename, and name the new layout.
3. Choose new elements with Insert Placeholder.
4. Save the Changes.
5. Confirm by selecting Home, then Layout.
When a custom slide layout is created, the steps to complete this task in the correct order are as follows:
What do you mean by layout?A layout refers to the parts of something that are arranged or laid out.
The steps to complete this task are as follows:
In the slide master tab, select insert layout.Click rename and name the new layout.Choose new elements with an Insert placeholder.Save the changes.Confirm by selecting home and then the layout.Learn more about Layout here:
https://brainly.com/question/1327497
#SPJ2
relevez le rôle principal de la peau dans l,organime humain. je suis bloquée aidez moi metci
Answer:
language?
Explanation:
What is my mistake in this case?
Answer:
I think it suppose to be #print out house
Answer:
i guess take the hint, bro.
Explanation:
What Pre-Built PC should I get? I don't have a lot of money so I'm looking for cheap options.
Answer:
for a gaming pc i recommend better graphic cards and for streaming gpu you can find some good options online not exactly sure what model.
Arrange the code so that the numbers are swapped.
Whats wrong with this and how do I fix it?
Answer:
this happened to me before.. there isn't anything wrong you just have to wait a little
Explanation:
the windows logon process has unexpectedly terminated
Answer
Windows corrupted
Explanation:
Try buying a new windows or resetting your laptop/pc
or your service failed to register/start
Windows login allows user accounts to log on to the system by opening the subscriber notification database and initiating user-level operations. The system may start with reduced functionality if the system resources required for Windows logon are insufficient.
What windows logon process has unexpectedly terminated?In order to read the list of user accounts that are set up for the machine, the Windows operating system reads the registry at logon.
The Windows logon page won't appear if the data can't be read, making it impossible for users to sign in to Windows. The level of registry damage determines whether Windows can finish the startup procedure or not.
You will need to boot the computer into the Recovery Console rather than Windows in this circumstance. Use the Startup Repair tool after entering the Recovery Console. For Windows installations that won't boot, Startup Repair automates frequent diagnostic and repair activities.
Therefore, All logon attempts, however, will be blocked if the Windows registry is seriously damaged. Windows crashes when you try to log on, and it restarts after that.
Learn more about Windows here:
https://brainly.com/question/6969788
#SPJ5
it is defined as the interloping of yarn with the use of a hook to make a design . A smocking B knitting C crocheting D embroidery
Answer:
letter C
Explanation:
because the crocheting is defined as the interloping yarn and use to make and made a design to excellent.
which type of writing is most commonly used in the field of information technology
Answer:
Technical writing
.........
In the program to evaluate passwords, you gradually built a message to display to the user. What did you add to the end of each message string to start each message on a new line?
message = message + "Your password needs an uppercase letter. _____ "
\endline
\e
\n
\newline
The option that one need to add to the end of each message string to start each message on a new line is \n.
What is a message string?This is known to be a kind of running aspect of text messages that relates to one topic or any question.
Based on the program written above, the option that one need to add to the end of each message string to start each message on a new line is \n as it is the one that will give the best result.
Learn more about program from
https://brainly.com/question/1538272
#SPJ2
How to recover permanently deleted photos from gallery?
Answer:
it's technically impossible to recover permanently deleted photos
but if you have a copy of the photo or maybe have backup that would help.
I'm sorry if my answer isn't much help
Lacking in movement, action, or change, especially in a way viewed as undesirable or uninteresting�
Question 11 options:
Malicious
Algorithm
Static
Web Browser
Answer:
Static
Explanation:
I just took the test man!
how to connect apple pencil 2 to ipad 8th generation?
Answer:
That pencil doesn't adjust to that ipad because those two aren't compatible
Explanation:
what type is the combination of an integer and a string
Answer:
Concatenation.
Explanation:
in reference to operating systems, what is spooling? what does it stand for? chegg
Answer:
Spooling is a process in which data is temporarily held to be used and executed by a device, program or the system. Data is sent to and stored in memory or other volatile storage until the program or computer requests it for execution. "Spool" is technically an acronym for simultaneous peripheral operations online.
This is an image of the ...................... Topology. * If you get it right i will mark you brainlist
Answer:
Tree
Explanation:
I WILL GIVE BRAINLIEST TO WHOEVER HELPS ME
I keep pressing the "fn" key or "function" key and the disable / enable touchpad button
fn + f9 = enable/disable touchpad
but all it's doing is disabling it, everytime I press to enable it just keeps saying "touchpad has been disabled"
Assuming you're using Windows 10/11, navigate to settings --> Bluetooth and settings --> Touchpad (Or just search Touchpad on your search bar) --> Toggle the touchpad on.
Hope this helps! :)
Question 1 Which portion of the PuTTY package allows you to perform file transfers using the SCP (Secure Copy) protocol?
There are different aspect of computing. The portion of the PuTTY package that allows you to perform file transfers using the SCP (Secure Copy) protocol is pscp.exe.
The pscp.exe tool commonly called the PuTTY Secure Copy Client is known to be the only portion of the Putty package that can let you copy files to and from remote computers through the use of the SCP.
Secure Copy (SCP) is simply defined as a computer command that one can use in Linux to copy files from one computer to another on a network. PuTTY is simply known to be a free implementation of SSH (and telnet) used for computer that running Microsoft Windows.
Learn more about the PuTTY package from
https://brainly.com/question/13171394
Oil refining is an example of:
Construction Production
Extractive Production
Domestic Production
Traditional Production
Answer:
i think the answer is B but i could be wrong...
Answer:
Extractive production
Explanation:
See
Oil refining denotes to after oil extraction situationFirst oil is extracted then gets refinedSo it's extractive productionMichaela has been tracking the temperatures of the dirt, pond water, and air near her home for a science investigation. She is ready to analyze the data to prepare for her science report. Based on each application’s strengths and weaknesses, which one would be the best to choose for this task?
Answer:
The science of investigation
Explanation:
hope it help
HELP PLEASE!!
which of the following is document content that displays at the top of every page?
Explanation:
that is a trick question if you need help ask your teacher
Answer:
Title
Explanation: