Write a Haskell script called HelloWorld.hs that prints "Hello World!" in the following ways:
1. Use one ptrStrLn. Recall: putStrLn :: String -> 10
() writes a string and moves to a new line.
2. Uses the do function, putStr, and putChar, with the two strings: "Hello" and "World!". Recall: putStr:: String -> 10 () writes a string without moving to a new line, and putChar:: Char -> IO () writes a single character to the screen.

Answers

Answer 1

Sure, here's the Haskell script for you:

-- HelloWorld.hs

Explanation:

let's dive a bit deeper into the Haskell script for printing "Hello World!" in two different ways:

-- Method 1: Using putStrLn

main = putStrLn "Hello World!"

In this method, we use the putStrLn function, which takes a string as an argument and prints it to the console, followed by a newline character to move to the next line. The main function is the entry point of a Haskell program, so this line of code tells the compiler to print "Hello World!" to the console when the program runs.

-- Method 2: Using do function, putStr, and putChar

main = do

putStr "Hello "

putChar 'W'

putChar 'o'

putChar 'r'

putChar 'l'

putChar 'd'

putStrLn "!"

In this method, we use a combination of the do function, putStr, and putChar functions to print "Hello World!" to the console. The do function is used to sequence multiple IO actions, which are the putStr and putChar functions in this case.

putStr takes a string as an argument and prints it to the console, without adding a newline character. Here, we use it to print the string "Hello".

putChar takes a single character as an argument and prints it to the console. In this case, we use it to print each letter of the string "World!" one by one, since putChar can only print one character at a time.

Finally, we use putStrLn to print the exclamation mark and move to a new line. Since we used putStr earlier, we need to use putStrLn here to make sure we move to a new line before printing the exclamation mark.

So there you have it, two different ways to print "Hello World!" in Haskell!

Know more about the program click here:

https://brainly.com/question/14368396

#SPJ11


Related Questions

Jenny wants to create a network that can be accessed from any room in her house without physically connecting. Which type of network medium should she use?

Answers

Well I use AT&T in my house it works in all the rooms I suggest using AT&T

The type of network medium Jenny should use is wireless networks.

Given data:

Jenny should use a wireless network medium to create a network that can be accessed from any room in her house without physically connecting.

Wireless networks use radio waves or infrared signals to transmit data between devices, allowing for flexible connectivity without the need for physical cables.

Devices such as smartphones, laptops, tablets, and smart home devices can connect to the wireless network and access the internet or communicate with each other.

To learn more about wireless networks, refer:

https://brainly.com/question/31630650

#SPJ3

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

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:

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

True or false, the total number of clock cycles (cc) for a delay loop of 10 ms for 2-mhz 8086 clock is 10,000 cc.

Answers

Answer:

FALSE is the answer of that question

I HOPE IT HELP YOU

________ software modules deal with setting employee objectives, performance, and compensation. scm prm drm erm sfa

Answers

ERM software modules deal with setting employee objectives, performance, and compensation. option D is the answer.

What are software modules?

Software module are component of a program and not the main programme.

They form essential part of the main programme with or more routines. One or more modules developed separately make up a program.

ERM software can be used for various businesses and in organization settings. It helps to identify compensation and monitor performance of the organization.

Enterprise risk software (ERM) is essential in managing various risk attached to a Job.

Therefore, ERM software modules deal with setting employee objectives, performance, and compensation

Learn more on software below

https://brainly.com/question/14635097

#SPJ1

Say true or false
Computer is the main tool of ICT.
b. Cyber crimes play positive role for better use of ICT

Answers

It would be false so (b)
The answers are
a) true
b) false

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())

Paul has opened a bespoke tailoring shop. He wants to work online to keep a database of all his customers, send e-mails when garments are ready, create designs, and maintain financial records using software. Which productivity suite should he consider?.

Answers

In the case above, the productivity suite that Paul should consider is OpenOffice, G suite.

What is G Suite used for?

G Suite Basic edition is known to be a kind of a suite that is made up of collaborative productivity apps that tends to give one's business professional email, shared calendars, and others.

Hence, In the case above, the productivity suite that Paul should consider is OpenOffice, G suite.

See options below

Which productivity suites should he consider?

a. Prezi, G suite

b. G suite, Zoho

c. OpenOffice, G suite

d. Zoho, Apple iWork

Learn more about financial records from

https://brainly.com/question/4954869

#SPJ1

NEED HELP ASAP
If you had two proxy servers located in the same room, what use could you make of them?

nothing
create a hub
sell one of the servers
set up a network neutral zone

Answers

If you had two proxy servers located in the same room, what use could you make of them? B. Create a hub

What is a Proxy Server?

A proxy server is a server program used in computer networking that stands between a client requesting a resource and the server supplying that resource.

Every computer or Ethernet-based device linked to a network hub receives data that is broadcast to all of those devices and that's what two proxy servers would be used to do.

Read more proxy servers here:

https://brainly.com/question/28075045
#SPJ1

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

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

Classes that depend on field names from parent classes are said to be ____ because they are prone to errors.Group of answer choicesrobustinnovativefragileconstructive

Answers

Classes that depend on field names from parent classes are generally said to be fragile because they are very prone to coding errors.

What is a class?

A class can be defined as a user-defined blueprint (prototype) or template that is typically used by software programmers to create objects and define the data types, categories, and methods that should be associated with these objects.

In object-oriented programming (OOP) language, a class that is written or created to implement an interface would most likely implement all of that interface's method declarations without any coding error.

In Computer programming, we can infer and logically conclude that classes that are highly dependent on field names from parent classes are generally said to be fragile because they are very prone to coding errors.

Read more on class here: brainly.com/question/20264183

#SPJ1

Create a directory called projects directly inside /home/fparker. Change the owner of /home/fparker/projects to the fparker user and change the group to the fparker group. Create a user account named ljenkins and set password123 as the password. Format the third drive's only partition with the ext4 file system.

Answers

cd /home/fparker
mkdir projects
chown /home/fparker/projects fparker:fparker
adduser ljenkins (set password to password123 in menu)

Use either “fdisk” or “parted” to format the disk, I can’t completely answer that part of the question without knowing the hierarchy of the file system)

To perform the tasks you described, you would need administrative privileges or use the appropriate commands with 'sudo'.

What is directory?

A directory, also known as a folder, is a file system construct used to organize and store files and other directories. It acts as a container for grouping related files and subdirectories together in a hierarchical manner. Directories are an essential part of the file system structure in modern operating systems.

Here are the steps to achieve each task:

1.  Create a directory called "projects" directly inside /home/fparker:

mkdir /home/fparker/projects

2. Change the owner and group of /home/fparker/projects to the fparker user and group:

chown fparker:fparker /home/fparker/projects

3. Create a user account named ljenkins and set "password123" as the password:

useradd ljenkins                # Create the user account

passwd ljenkins password123    # Set the password for the user

After successfully completing these steps, you will have created the "projects" directory inside /home/fparker, changed its owner and group to fparker, created a new user account named ljenkins with the password "password123," and formatted the third drive's partition with the ext4 file system.

Learn more about directory on https://brainly.com/question/29757285

#SPJ2

Discuss how progressive deepening uses a mixture of dfs and bfs to eliminate the disadvantages of both and at the same time finds the solution is a given tree. support your answer with examples of a few trees.

Answers

IDDFS is known to use both depth-first search’s space-efficiency and also the use of breadth-first search’s fast search due to the fact that  its nodes are closer to the root and IDDFS often calls DFS for a lot of depths starting from a starting value.

What is progressive deepening?

The term progressive deepening is known to be if a person is said to be making effort try to approximate a given answer at every level and they often work to go deep towards the leaf nodes based on the time limit that a person have for their move.

Hence, IDDFS is known to use both depth-first search’s space-efficiency and also the use of breadth-first search’s fast search due to the fact that  its nodes are closer to the root and IDDFS often calls DFS for a lot of depths starting from a starting value.

Learn more about deepening from

https://brainly.com/question/27353529

#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

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

On a Local Area Network, or LAN, what identification do nodes use to communicate with each other internally

Answers

On a Local Area Network, or LAN. MAC addresses are the identification that nodes use to communicate with each other internally. This is further explained below.

What is the MAC address?

Generally, A media access control address, often known as a MAC address, is a one-of-a-kind identification that is given to a network interface controller (NIC) in order for it to be used as a network address in communications that take place inside a network segment. This use is typical in the vast majority of networking technologies based on IEEE 802, such as Ethernet, Wi-Fi, and Bluetooth.

In conclusion, On a LAN, or local area network. Nodes interact with each other inside using MAC addresses.

Read more about the MAC address

https://brainly.com/question/27960072

#SPJ1

A router is connected to network 192.168.1.0/24 and network 192.168.2.0/24. The router is configured to use RIP and has learned both networks. The next hop router for network 192.168.3.0 has changed. You need to make the change with the least amount of effort possible. What should you do

Answers

In the case above, the thing that should be done is for one to Drop the packet.

What is a router?

A router is known to be a form of a physical or virtual tools that often helps one to pass information and it is said to be between two or more packet-switched computer networks.

Note that, In the case above, the thing that should be done is for one to Drop the packet.

Learn more about router from

https://brainly.com/question/24812743

#SPJ1

A designer wraps up a final prototype of a language learning app in Adobe XD, and wants to share their work with the development team. Before they publish the prototype on the cloud, they name the file: LanguageApp-Version-Final. Does this file name reflect best practices

Answers

In the case above, file name do not reflect best practices and as such it is No. A file name must include the date, the author, and the version number.

Why should a filename reflect its contents?

A file name is known to be the key identifier of a file and a Good file name need to present some clues in regards to its content, status and version.

Hence, In the case above, file name do not reflect best practices and as such it is No. A file name must include the date, the author, and the version number.

See options below

Does this file name reflect best practices?1 point

Yes. A file name should include the project name and version.

No. A file name must include the date, the author, and the version number.

Learn more about file name from

https://brainly.com/question/1982059

#SPJ1

Refer to Table 8-4. Consider the data above (in billions of dollars) for an economy: Gross domestic product (in billions of dollars) for this economy equals

Answers

If one uses the data above (in billions of dollars), the Gross domestic product (in billions of dollars) for this economy equals  $1,200.

What is the GDP about?

Note that:

GDP (Gross Domestic Product):

Thus it will be :

Consumption + Investment + Government expenditure + (Export - Import)

Which is:

GDP = 800 + 200 + 300 + (100 - 200)

GDP = $1200 billions

See full question below

Consumption expenditures $800

Investment expenditures 200

Government purchases 300

Exports 100

Imports 200

Wages 800

8) Refer to Table above. Consider the data above (in billions of dollars) for an economy: Gross domestic product (in billions of dollars) for this economy equals

A) $2,200.

B) $1,600.

C) $1,400.

D) $1,200.

Learn more about GDP from

https://brainly.com/question/1383956

#SPJ1

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

Add a media query that applies when the viewport's width is at least 600px. Use the .benefits-container selector to set flex-direction: row;

Answers

The media query that applies when the viewport's width is at least 600px will be:

media only screen and (min-width: 600px) {

   .benefits-container {

       flex-direction: row;

   }

What are media queries?

Media queries are the key part of responsive web design that allows the user to create different layouts depending on the size of the viewport.

They can also be used to detect other things about the environment your site is running on.

Learn more about media query on:

https://brainly.com/question/13136637

#SPJ1

Kevin would like to ensure that his software runs on a platform that is able to expand and contract as needs change. Which one of the following terms best describes his goal

Answers

A terminology which best describe Kevin's goal in terms of expansion and contraction as needs change is: A. Scalability.

What is scalability?

Scalability can be defined as a measure of the ability of a system to change (expansion or contraction) in performance and cost as a result of changes in demands of application and system processing, especially in a network architecture.

In this context, we can logically deduce that a terminology which best describe Kevin's goal in terms of expansion and contraction as needs change is scalability.

Read more on scalability here: brainly.com/question/14301721

#SPJ1

Complete Question:

Kevin would like to ensure that his software runs on a platform that is able to expand and contract as needs change.  Which one of the following terms best describes his goal? A. Scalability B. Elasticity C. Cost effectiveness D. Agility

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

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

Brenda also orders movies and television through the Internet via a(n) ____ provider, which allows users to download video for a fee.

Answers

Brenda also orders movies and television through the Internet via a(n) VOD provider, which allows users to download video for a fee.

What is the meaning of the term VOD?

The term video-on-demand (VOD) is known to be a kind of technology made to send video content, such as movies and television programs, directly to specific customers for quick viewing.

Note that technology is constantly growing and one need to grow along with it. services that are good is often adopted by people.

Hence, Brenda also orders movies and television through the Internet via a(n) VOD provider, which allows users to download video for a fee.

Learn more about movies from

https://brainly.com/question/27936956

#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

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

Use the writeln() method of the document object to display the current platform in a

tag in the webpage. Hint: The platform property of the window.navigator object contains the current platform.

Answers

Using the knowledge in computational language in JAVA it is possible to write a code that the document object to display the current platform in a tag in the webpage

Writting the code in JAVA:

<TABLE>

     <ROWS>

     <TR>

     <TD>Shady Grove</TD>

     <TD>Aeolian</TD>

     </TR>

     <TR>

     <TD>Over the River, Charlie</TD>

     <TD>Dorian</TD>

     </TR>

     </ROWS>

     </TABLE>

   

See more about JAVA at brainly.com/question/12975450

#SPJ1

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 equalsignoreCase() method for comparing strings, ignoring case. The program must define and call a method: public static int getWordFrequency(String[] wordsList, int listSize, String currWord) LAB ACTIVITY 8.45.1: LAB: Word frequencies - methods 0 / 10 LabProgram.java Load default template... Слд 1 import java.util.Scanner; 2 3 public class LabProgram { 4 5 /* Define your method here */ 6 7 public static void main(String[] args) { 8 /* Type your code here. */ 9 } 10 } 11 NO

Answers

Using the knowledge in computational language in JAVA it is possible to write the code being methods define a method named getWordFrequency that takes an array of strings

Writting the code in JAVA:

import java.util.*;

public class WordFrequency {

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

               HashMap<String , Integer> hm = new HashMap<>();

               for(String st : wordsList) {

                       String str = st.toLowerCase();

                       hm.put(str, hm.getOrDefault(str, 0) + 1);

               }

               for(String st : wordsList) {

                       String str = st.toLowerCase();

                       System.out.println(st + " " + hm.get(str));

               }

               String currWordToLowerCase = currWord.toLowerCase();

               return hm.get(currWordToLowerCase);

       }

       public static void main(String[] args) {

               // TODO Auto-generated method stub

               String[] wordsList = {"hey" , "Hi" , "Mark" , "hi" , "mark"};

               int listSize = wordsList.length;

               String currWord = "hey";

               System.out.println("The frequency of " + currWord + " is : " + getWordFrequency(wordsList , listSize , currWord));

       }

}

See more about JAVA at brainly.com/question/12978370

#SPJ1

Other Questions
A rectangular waterbed is 8 ft long, 7 ft wide, and 1.5 ft tall. How many gallons of water are needed to fill the waterbed? Assume 1 gallon is 0.13 cu ft. Round to the nearest whole gallon. When asked to describe themselves, people from __________________________ cultures tend to emphasize how the self is different from others. Which question applies predictive thinking to a public policy solution?A-What incentives might government offer to encourage compliance with the policyB-What criteria should be used to judge the efficacy of the solution implemented?C-Which policy idea has the best chance at meeting all identified criteria?D-Which organizations and individuals can best help identify policy solutions? Which of the choices illustrates the law of demand What type of cross is a mating between two individuals that are both heterozygous for the same two genes? multiple choice question. To achieve _____________________, press down through the ball and heel of the foot and spread the toes. The _________________ is composed of and endothelial layer that is continuous with the endocardium of the heart. A leading cause of death in children younger than 14 years could be prevented by:_______ Find angle ABH please please Can u guys please give me the correct answer State all integer values of x in the interval [2,8] that satisfy the following inequality: 5x+ 4 > 19 In an arithmetic sequence the first term is 2 and the second term is 5 , find the eighth term What organelles do plants have in their roots that helps them to sense gravity?a) stigmab) statocytec) starchd) stamen What guidelines should you follow prior to ordering and installing memory in an hp business pc or notebook? What technique is most commonly associated with the use of malicious flash drives by penetration testers A triangle is shown with its exterior angles. The interior angles of the triangle are angles 2, 3, 5. The exterior angle at angle 2 is angle 1. The exterior angle at angle 3 is angle 4. The exterior angle at angle 5 is angle 6. Which statements are always true regarding the diagram? Select three options. m5 + m3 = m4 m3 + m4 + m5 = 180 m5 + m6 =180 m2 + m3 = m6 m2 + m3 + m5 = 180 A perimeter of a movie screen is 56 meters. the area is 171 square meters what are the dimensions of the screen Jesse slowly made his way into the classroom. He sat in the back row and put his head down. Mr. Miser announced that today they were playing a trivia game and the winning students would extra credit. What can you infer from this story Please help!! is there a solution to z = x + y for a right triangle? If people lose faith in the safety and security of financial institutions, what will happen to the u. S. Economy?