LAB: Word frequencies - methods Define a method named getWordFrequency that takes an array of strings, the size of the array, and a search word as parameters. Method getWordFrequency() then returns the number of occurrences of the search word in the array parameter (case insensitive). Then, write a main program that reads a list of words into an array, calls method getWordFrequency() repeatedly, and outputs the words in the arrays with their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain less than 20 words.
Ex: If the input is: 5 hey Hi Mark hi mark the output is: hey 1 Hi 2 Mark 2 hi 2 mark 2 Hint: Use the equalslgnoreCase() method for comparing strings, ignoring case. Hint: Use the equalslgnoreCase() method for comparing strings, ignoring case. The program must define and call a method: public static int getWordFrequency(String[] wordsList, int listSize, String currWord).

Answers

Answer 1

The program is an illustration of loops, functions and conditional statements

Loops are used for repetitionFunctions are used to group related code statements in a blockConditional statements are used to make decisions

The program in Java

The program written in Java, is as follows:

import java.util.Scanner;

public class Main {

   public static int getFrequencyOfWord(String[] wordsList, int listSize, String currWord) {

       int wordFreq = 0;

       for (int i=0; i<listSize; i++){

           if (wordsList[i].compareToIgnoreCase(currWord)==0){

               wordFreq++;

           }

       }

       return wordFreq;

   }

       public static void main(String[] args) {

           Scanner input = new Scanner(System.in);

           int N = input.nextInt();

           String myArr[] = new String[N];

           for (int i=0; i<N; i++){

               myArr[i] = input.next();

           }

           for (int i=0; i<N; i++){      

               String searchWord = myArr[i];

               int freqCount = getFrequencyOfWord(myArr,N,searchWord);

               System.out.println(searchWord + " " + freqCount);

       }              

  }

}

Read more about java programs at:

https://brainly.com/question/26642771

#SPJ1


Related Questions

Which web 2.0 feature utilizes application programming interfaces (apis) to automate web content and/or processes?

Answers

Software as a service (SaaS) is known to be web 2.0 feature that utilizes application programming interfaces (apis) to automate web content and/or processes.

What is SaaS?

SaaS, or software as a service, is known to be a kind of an on-demand access that is said to be often in a ready-to-use format and it is also a cloud-hosted application software.

Note that Software as a service (SaaS) is known to be web 2.0 feature that utilizes application programming interfaces (apis) to automate web content and/or processes.

Learn more about web 2.0 from

https://brainly.com/question/12105870

#SPJ1

All of the following formats may contain incorrect or misleading information. on which should you be most careful about trusting the information you come across as it may seem academically reviewed but in fact is not?

Answers

Wikis is the one on which should you be most careful about trusting the information you come across as it may seem academically reviewed but in fact is not.

What is Wikis?

A wiki is known to be a form of a collaborative tool that is used and one that aids students to make their own contribution and change one or more pages of course linked materials.

Note that based on the above, Wikis is the one on which should you be most careful about trusting the information you come across as it may seem academically reviewed but in fact is not.

Learn more about Wikis from

https://brainly.com/question/25153373

#SPJ1

Password complexity, password history, and password reuse are all examples of what?

Answers

Password complexity, password history, and password reuse are all examples of account policies.

What are Account policies?

This refers to the document which contains the requirements necessary for maintaining or creating an account on computer systems or networks.

These policies vary from password complexity to avoid accounts being compromised to password history so as to be able to recover passwords on the system. This is achieved by the use of unique letters and numbers which are difficult to access by a third party thereby making it the most appropriate choice.

Read more about Account policies here https://brainly.com/question/14364696

#SPJ1

how to print in this on python
#
# #
# # #
# # # #
# # # # #

Answers

Answer:

triangular ##&((+ hhvbh. hhhb hhv

Answer:

for i in range(1, 6):

   print(("# " * i).rstrip())

Explanation:

You need to print one hashtag, then 2, then 3, and so on. We can use Python's string multiplication to get each line quicker.

String multiplication is an easy way to repeat the same string a certain number of times. It's done by multiplying the string to a number.

For example,

"hello" * 6

>> "hellohellohellohellohellohello"

If we multiply the string "#" by any number, we would get a number of hashtags side by side, without any space. To easily avoid this, we can multiply "# " instead to automatically put a space to the right of each hashtag.

We can use a for loop that goes through range(1, 6) to print out 5 rows.

for i in range(1, 6):

Then, we can print the string "# " multiplied by i.

print("# " * i)

However, this will also put a space at the end of the string, which we do not want to print. Hence, we can use the .rstrip() method to strip the string of any spaces on the right. We will first put the whole string in parentheses, then invoke rstrip on it.

print(("# " * i).rstrip())

Let's put both lines together.

for i in range(1, 6):

   print(("# " * i).rstrip())

You want to make sure that all users have passwords over eight characters in length and that passwords must be changed every 30 days. What should you do

Answers

Answer:

Configure account policies in Group policy.

Explanation:

When starbucks sells its coffee and mugs to the public on its website, it is a ________ sale.

Answers

When a business firm such as Starbucks sells its products (coffee and mugs) to the general public on its website, it is a B2C sale.

What is B2C?

B2C is a business model which literally means business to consumer and it can be defined as a market which involves businesses selling their products and services directly to the end consumers for their personal use, usually over a website.

In this context, we can infer and logically deduce that when a business firm such as Starbucks sells its products (coffee and mugs) to the general public on its website, it is a B2C sale.

Read more on B2C here: https://brainly.com/question/2829594

#SPJ1

Theorem: for any two real numbers, x and y, if x and y are both rational then x y is also rational. Which facts are assumed and which facts are proven in a proof by contrapositive of the theorem?

Answers

The facts that are assumed and the facts  that are proven in a direct proof of the theorem is that option a) Assumed: x is rational and y is rational and Proven: x + y is rational.

What is a theorem?

The term known as theorem is known to be a kind of a formula, or statement that is seen in a lot of mathematics field and it also known top  be the logic deduced.

Note that it is also seen as the result that is said to have been proved to be true (through the use of operations and facts that are said to be already known).

Therefore, The facts that are assumed and the facts  that are proven in a direct proof of the theorem is that option a) Assumed: x is rational and y is rational and Proven: x + y is rational.

Learn more about Theorem from

https://brainly.com/question/343682

#SPJ1

See full question below

Theorem: For any two real numbers, x and y, if x and y are both rational then x + y is also rational. Which facts are assumed and which facts are proven in a direct proof of the theorem?

a) Assumed: x is rational and y is rational

Proven: x + y is rational

b) Assumed: x + y is irrational

Proven: x is irrational and y is irrational

c) Assumed: x + y is rational

Proven: x is rational or y is rational

d) Assumed: x is rational or y is rational

Proven: x + y is rational

What guidelines should you follow prior to ordering and installing memory in an hp business pc or notebook?

Answers

In computer, the guidelines that should be followed prior to ordering and installing memory in an hp business pc or notebook is to verify that the network cable is plugged in.

What is computer?

It should be noted that a computer simply means the electronic device that can be used to make one's work easier.

In this case, in computer, the guidelines that should be followed prior to ordering and installing memory in an hp business pc or notebook is to verify that the network cable is plugged in. This is important to allow for easy installation.

Learn more about computer on:

brainly.com/question/24540334

#SPJ1

Illuminate all lamps and leds, remove fuses, and verify that trouble signals occur when testing

Answers

Illuminate all lamps and leds, remove fuses, and verify that trouble signals occur when testing for voltage.

What tool can Technicians use to check the lighting and accessory circuits?

The technician can use a Voltmeter, ohmmeter, or continuity test and this is one that can best be used to test the  above circuits.

Hence, Illuminate all lamps and leds, remove fuses, and verify that trouble signals occur when testing for voltage.

Learn more about circuits from

https://brainly.com/question/2969220

#SPJ1

If you forget to put a closing quotation mark on a string, what kind of error will be raised?

Answers

If you forget to put a closing quotation mark on a string, compilation (syntax) error is the kind of error that will be raised.

What is a closed quotation mark?

The symbol is known to be one that is often used at the start of the quotation ("opening quotation mark") and it is one that is usually seen as “ ("open inverted commas") or ' ("open inverted comma").

Note that in  regards to computer science, a syntax error is known to be a kind of an error that is often seen in the syntax of any given sequence of characters or what we call tokens that is said to be made or intended to be written in a specific programming language.

Therefore,  If you forget to put a closing quotation mark on a string, compilation (syntax) error is the kind of error that will be raised.

Learn more about quotation mark from

https://brainly.com/question/2762082

#SPJ1

Where does customer information, such as news articles, videos, large amounts of text, images, or audio files, generally get stored for web services?

Answers

The place where the customer information, such as news articles, videos, large amounts of text, images, or audio files, generally get stored for web services is the database.

What is database?

It should be noted that the database is a collection of structured information or data that are stored in the electronic system.

In this case, the place where the customer information, such as news articles, videos, large amounts of text, images, or audio files, generally get stored for web services is the database. It is conteolled by the database management system.

Learn more about database on:

brainly.com/question/26096799

#SPJ1

One of the many roles of the security compliance committee is to focus on controls that are widely used across a large population of applications, systems, and operations. These types of controls are known as ___________________.

Answers

ghffyhhuuhhhvccfghhnnnjki

The telephone system is an example of a ________ network

Answers

The telephone system is an example of a circuit-switched network.

Is telephone a circuit switched network?

Yes. The  Traditional telephone systems  such as landlines are known to be a common  example of a technology that are said to often make use of the circuit switching.

Hence, The telephone system is an example of a circuit-switched network is a true statement.

Learn more about telephone  from

https://brainly.com/question/917245

#SPJ1

In the context of customer relationship management (CRM) applications, which approach is often chosen by organizations with an established IT infrastructure

Answers

The on-premise approach is often chosen by organizations with an established IT infrastructure.

What is the On Premises?

In an on-premises method, resources are said to be given or deployed in-house and it is one that is found within an enterprise's IT infrastructure.

Customer relationship management (CRM) is known to be a form of a technology that is often used in the act of managing all of a firm's  relationships and communications with customers and also that of potential customers.

Therefore, The on-premise approach is often chosen by organizations with an established IT infrastructure.

Learn more about CRM from

https://brainly.com/question/27373018

#SPJ1

A developer created a helper class with a method that can be called from Visualforce pages, web services, triggers, and of even anonymous code. When the method is called from a trigger

Answers

Since the developer created a helper class with a method that can be called from Visualforce pages, the  method is as a result of a trigger known as option A. Check if Trigger.isExecuting ==true.

Who is a system developer?

A systems developer is known to be one among the type of software developer.

Note that they are known to be the person that is said to be responsible as they help to create and implement applications and programs for the backend processing systems that is said to be often used in regards to  businesses and organizations.

Note that Backend processing systems are said to be a behind-the-scenes aspect  of software and as such, Since the developer created a helper class with a method that can be called from Visualforce pages, the  method is as a result of a trigger known as option A. Check if Trigger.isExecuting ==true.

See full question below

A developer created a helper class with a method that can be called from Visualforce pages, web services, triggers, and of even anonymous code. When the method is called from a trigger, the developer needs to execute logic that should not be executed If the method Is called from anywhere else. How can the developer determine if the code Is executed in a trigger context?

A. Check if Trigger.isExecuting ==true

B. Check if Trigger.newMap !=null.

C. Check if System.executionContext =='Trigger'.

D. Use the executeOnTrigger annotation on the method definition.

Learn more about  developer from

https://brainly.com/question/11352260

#SPJ1

Which mynav module serves as the source for sales and delivery content, assets, and intellectual property across industries??
possible answers (only one right):
a) industry module
b) cloud advisor
c) green cloud module
d) talent advisor

Answers

The Industry Module of the mynav module serves as the source for sales and delivery content, assets, and intellectual property across industries.

What is industry module myNav?

myNav is known to be one that simulates how a given solutions will act at scale, and it also validates it's the right in regards to fitting in for the first time.

Hence, The Industry Module of the mynav module serves as the source for sales and delivery content, assets, and intellectual property across industries.

Learn more about mynav from

https://brainly.com/question/27117515

#SPJ1

What type of email communication reaches out to former clients and older prospects and encourages a reply? Strategic email Onboarding email Reengagement email Promotional email

Answers

A type of email communication that reaches out to former clients and older prospects and encourages a reply is: C. reengagement email.

What is an e-mail?

An e-mail is an acronym for electronic mail and it can be defined as a software application (program) that is designed and developed to enable users send and receive both texts and multimedia messages over the Internet.

In Computer Networking, a reengagement email is a type of email communication that is designed and developed to reach out to former clients and older prospects, and it encourages a reply.

Read more on e-mail here: brainly.com/question/15291965

#SPJ1

Lucy is trying to decide what sources to use in her literature review. The type of sources Lucy will use in her literature review will depend on which of the following?

Answers

The type of sources Lucy will use in her literature review will depend on the type of literature review and the discipline.

What is in the literature review?

A literature review is known to be a form of a detail summary of former research on a topic.

Note that the literature review is one that looks into scholarly articles, books, area of research and as such, the type of sources Lucy will use in her literature review will depend on the type of literature review and the discipline.

Learn more about literature review from

https://brainly.com/question/13708299

#SPJ1

In a typical office, biometric authentication might be used to control access to employees and registered visitors only. We know the system will have some false negatives, some employees falsely denied access, so we need a human override, someone who can examine the employee and allow access in spite of the failed authentication. Thus, we need a human guard at the door to handle problems as well as the authentication device; without biometrics, we would have had just the guard. Consequently, we have the same number of personnel with or without biometrics, plus we have the added cost to acquire and maintain the biometrics system. Explain the security advantage in this situation that justifies the extra expense.

Answers

The security advantage in this situation that justifies the extra expense is that these Biometric devices is one that separates the handling of issues regarding biometric information from the system operating system.

It is one that render it impossible for hackers to alter the authentication process.

What is the aim of biometric authentication?

An biometric authentication is known to be a device that is used to handle access in regards to physical and digital resources, e.g. buildings, rooms and other forms of computing devices.

Note that the security advantage in this situation that justifies the extra expense is that these Biometric devices is one that separates the handling of issues regarding biometric information from the system operating system.

It is one that render it impossible for hackers to alter the authentication process.

Learn more about Biometric devices from

https://brainly.com/question/19096951

#SPJ1

Completar Fill in the blanks with the correct familiar commands. dar (negative) 1 of 1 Question 2 with 1 blank hacer (affirmative) 1 of 1 Question 3 with 1 blank ir (negative) 1 of 1 Question 4 with 1 blank poner (affirmative) 1 of 1 Question 5 with 1 blank hacer (negative) 1 of 1

Answers

The affirmative command hacer is known as haz.

The affirmative tú command decir - diThe  affirmative tú command ir  - veThe  affirmative tú command poner -pon

What is the translation about?

The translation are:

The affirmative tú command to do is known as do.The affirmative tú command to say - diThe affirmative tú command ir - veThe affirmative tú command to put -pon

The Affirmative tú commands is known to be one that is said to be similar  as the él/ella/Ud.

Note that this  is seen as the conjugation of the present tense and it is one that is often  used to tell another person that you are familiar with that thing.

Hence, The affirmative command hacer is known as haz.

The affirmative tú command decir - diThe  affirmative tú command ir  - veThe  affirmative tú command poner -pon

Learn more about Spanish words from

https://brainly.com/question/26522612

#SPJ1

9.1% complete Question A government agency is getting rid of older workstations. The agency will donate these workstations, along with other excess computer systems, to nearby schools. Management reminds the systems administrators about data sanitization and security concerns. What actions secure the systems prior to donating to the schools?

Answers

The action that can secure the systems prior to donating to the schools is that they should use a data sanitization tool and also replace the hard drive with an empty one .

What is the aim of a data sanitization tool?

The aim of data sanitization is for the full or total clearing of devices and getting rid of all sensitive data only if the storage device is not been used or is said to be transferred to another Information system .

Hence, The action that can secure the systems prior to donating to the schools is that they should use a data sanitization tool and also replace the hard drive with an empty one .

Learn more about policy  from

https://brainly.com/question/24233712

#SPJ1

What technique is most commonly associated with the use of malicious flash drives by penetration testers

Answers

Answer: Distributing malicious flash drives in a parking lot or other high-traffic area, often with a label that will tempt the person who finds it into plugging it in, is a technique used by penetration testers.

Explanation:

You have downloaded a file from the internet. You generate a hash and check it against the original file's hash to ensure the file has not been changed. Which information security goal is this an example of

Answers

Answer:

integrity

Explanation:

which of the following is required to establish a new network switch and configure its IP address for the first time

Answers

Out-of-band management is required to establish a new network switch and configure its IP address for the first time.

What is Out-of-Band management?

Out-of-Band management is known to be a form of services that makes sure that a tech do not require to be sent onsite and it is one where remediation can be done in a remote place.

Hence,  Out-of-band management is required to establish a new network switch and configure its IP address for the first time.

See full question below

Which of the following is required to establish a new network switch and configure its IP address for the first time?

A. Client-to-site VPN

B. Site-to-site VPN

C. Out-of-band management

D. In-band management

Learn more about IP address from

https://brainly.com/question/24930846

#SPJ1

Which of the following protocols is used by an email client to retrieve messages from an email server, giving users the option to keep mail messages on the server

Answers

IMAP  protocols is used by an email client to retrieve messages from an email server, giving users the option to keep mail messages on the server.

What is IMAP on one's email account?

IMAP is a term that connote Internet Message Access Protocol. IMAP helps one to be able to access the same inbox from a lot of devices.

Hence, IMAP  protocols is used by an email client to retrieve messages from an email server, giving users the option to keep mail messages on the server.

Learn more about email server from

https://brainly.com/question/15710969

#SPJ1

You are working for a large financial institution and preparing for disaster recovery and upcoming DR drills. A key component in the DR plan will be the MySQL database instances and their data. The Recovery Time Objective (RTO) is such that read replicas can be used to offload read traffic from the master database. Which items are key features of read replicas

Answers

The items that are key features of reading replicas are

inside AZ, across AZ, or even beyond the area - may establish RRAn individual database server instance was manually elevated to stand-alone statusEach RR with its own DNS destination may have up to five RRs per master.

This is further explained below.

What is the DR plan?

Generally, A disaster recovery plan, often known as a DRP, is a well-documented and organized strategy that outlines how an organization may swiftly go back to work in the aftermath of an unexpected event.

In conclusion, A disaster recovery plan, also known as a DR plan, is a formal document that is drafted by an organization and provides step-by-step instructions on how to react to unanticipated occurrences such as natural disasters, power outages, cyber-attacks, and any other kind of event that is disruptive.

Read more about the DR plan

https://brainly.com/question/2681783

#SPJ1

Which selection tool should be used to fill a vacancy that requires managing multiple priorities and working under pressure

Answers

The selection tool that should be used to fill a vacancy that requires managing multiple priorities and working under pressure is Behavioral Assessment.

Why is behavioral assessment vital?

Behavioral assessment is known to be that which helps us as humans to be able to look at how a person does their work and gains or get their objectives.

Therefore, The selection tool that should be used to fill a vacancy that requires managing multiple priorities and working under pressure is Behavioral Assessment because this is what it is.

See full question below

Which selection tool should be used to fill a vacancy that requires managing multiple priorities and working under pressure?

A. Cognitive Ability Test

B. Background Check

C. Behavioral Assessment

D. Academic Transcript

Learn more about Behavioral Assessment from

https://brainly.com/question/25816641

#SPJ1

Header file guards are preprocessor directives whose primary role is to cause the compiler to _____

Answers

Header file guards are preprocessor directives with the primary role to cause the compiler to allow defining a function that are usable throughout a user's program.

What is a header file?

A header file can be defined as a type of file which comprises macro definitions and C declarations and they are meant to be shared between several source files.

In Computer programming, header file guards are preprocessor directives with the primary role to cause the compiler to allow defining a function that are usable throughout a user's program.

Read more on header file here: https://brainly.com/question/23678678

#SPJ1

Write a while loop that prints user_num divided by 2 until user_num is less than 1. The value of user_num changes inside of the loop.

Answers

Answer:

user_num >= 1

while true do

print "user_num/2"

Explanation:

First, you write that the user_num is equal to or is greater than 1. Then you write in the while loop that while that's true, print user_num divided by two.

The ____ file is typically saved with a prefix of inc_.
a. insert
b. include
c. nested
d. increment

Answers

The include file is typically saved with a prefix of inc_.

What is include file?

The include (or require ) statement is known to be one that often takes the total text/code/markup that is seen in the specified file and it is one that copies it into a given file that uses what we call the include statement.

A file is known to be any form of documents and it is one that can be in any format such as pdf, doc and others.

Hence, in the case above, The include file is typically saved with a prefix of inc_ as that is the way to save it.

Learn more about file from

https://brainly.com/question/26125959

#SPJ1

Other Questions
A project has a net present value of $90,000 and a cost of money of 8%. From this information you can conclude that the internal rate of return is (above or below) 8%? When conflicts of interest exist, lenders generally take all of the following actions at the creation of a contract except:Multiple Choiceaccept the risk and set up a reserve for potential future issues.ensure that negative covenants are in the contract.impose higher interest rates to reflect greater default risk.ensure that affirmative covenants are in the contract. True/False : 4. flags changed when push instruction is used Please find the relative z value in the equation of P (Zz) = 0.8.A) 0.1584B) 0.8416C) -0.8416D) -0.1584 T/F. historically, for most social security recipients the amount of money they receive in benefits has been more than the total they paid in over their working years. explain in terms of chemical bonds why the hydrocarbon reactant is classified as unsaturated polyvinyl Consider the sum 4+ 11 + 18 + 25 + ... + 249. (a) How many terms (summands) are in the sum? (b) Compute the sum using a technique discussed in this section. 65. if a persons body has a density of 995kg/m3, what fraction of the body will be submerged when floating gently in (a) freshwater? (b) in salt water with a density of 1027kg/m3? Help me with all this please Next, Margarita asks you to complete the Bonuses Earned data in the range C12:H15. The amount eligible for a bonus depends on the quarterly revenue. The providers and staff reimburse the clinic $1250 per quarter for nonmedical services. The final bonus is 35 percent of the remaining amount. a. Using the text in cell C12, fill the range D12:F12 with the names of the other three quarters. b. In cell C13, enter a formula using an IF function that tests whether cell C9 is greater than 230,000. If it is, multiply cell C9 by 0.20 to calculate the 20 percent eligible amount. If cell C9 is not greater than 230,000, multiply cell C9 by 0.15 to calculate the 15 percent eligible amount. C. Copy the formula in cell C13 to the range D13:F13 to calculate the other quarterly bonus amounts. d. In cell C15, enter a formula without using a function that subtracts the Share amount (cell C14) from the Amount Eligible (cell C13) and then multiplies the result by the Bonus Percentage (cell C16). Use an absolute reference to cell C16. e. Copy the formula in cell C15 to the range D15:F15 to calculate the bonuses for the other quarters. need help. failing the final quarter for geometry Use the distance formula to find the distance between the points (2,5) and (14,10). What is meant by the phrase "individuals dont evolve"? Question 7 options: Some organism dont have the ability to evolve and all survive as they are. Individuals adapt, the term evolution is only used for species Traits become more or less common within a population as a result of success, rather than individuals acquiring new traits. how do you find out the area of a tent, floor included Refer to Exhibit 11-2. At point B, if we cut tax rates slightly, tax revenues. A. drop to zero. B. will not change. C. decrease. D. increase. evaluate the translational partition function for h2 confined to a volume of 126 cm3 at 298 k . (note: the avogadro's constant na=6.0221023 Leila, Keith, and Michael served a total of 87 orders Monday at the school cafeteria. Keith served 3 times as many orders as Michael. Leila served 7 more orders than Michael. How many orders did they each serve? Solve the equation.3x + 1 + 10x = x + 4x = x equals StartFraction one-half EndFractionx = x equals StartFraction 5 Over 6 EndFractionx = 12x = 18 a 48-year-old woman presents with nausea and vomiting. she underwent an appendectomy 3 days ago. a contrast-enhanced ct of the abdomen and pelvis reveals an ileus. what electrolyte abnormality commonly causes an ileus? true/false. Grand unified theories, or GUTs, predict that for temperatures several orders of magnitude above 1027 K, the strong, weak, and electromagnetic forces are indistinguishable from each other, but gravity is different.