1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
erastova [34]
3 years ago
6

g Write a program that allows a user to input any text in your program. Using the tools that we have discussed, your program sho

uld output how many unique words were in the input and then output how many words were unique.
Computers and Technology
1 answer:
Paladinen [302]3 years ago
5 0

Answer:

Explanation:

The following function/program is written in Java. It asks the user for a sentence as an input and then splits that sentence into an array of words. Then it creates an arrayList for all of the unique words, comparing each word in the sentence with all of those in the ArrayList. If a word is found in the ArrayList it cancels the loop and moves on the next word in the sentence. Finally, it counts all of the unique words in the ArrayList and prints that total to the screen.

public static void uniqueWords() {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a sentence:");

       String sentence = in.nextLine();

       String words[] = sentence.split(" ");

       ArrayList<String> uniqueWords = new ArrayList<>();

       for (int x = 0; x < words.length; x++) {

           boolean exists = false;

           for (int i = 0; i < uniqueWords.size(); i++) {

               if (words[x].equals(uniqueWords.get(i))) {

                   exists = true;

                   break;

               }

           }

           if (exists == false) {

               uniqueWords.add(words[x]);

           }

       }

       System.out.println(uniqueWords.size());

   }

You might be interested in
My Mac is stuck on this screen? How to fix?
mixer [17]

Answer:

Press and hold the power button for up to 10 seconds, until your Mac turns off. If that doesn't work, try using a cellular device to contact Apple Support.

Explanation:

If that also doesn't work try click the following keys altogether:

(press Command-Control-Eject on your keyboard)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This makes the laptop (macOS) instruct to restart immediately.

Hopefully this helps! If you need any additional help, feel free and don't hesitate to comment here or private message me!. Have a nice day/night! :))))

<em>Another Tip:</em>

<em>(Press the shift, control, and option keys at the same time. While you are pressing those keys, also hold the power button along with that.)</em>

<em></em>

<em>(For at least 10 seconds)</em>

6 0
4 years ago
Why am I not getting the activation link for my account?
Alex Ar [27]
Try resending it isn't there a button to resend the email? and look in spam
4 0
3 years ago
You have installed five new 300 GB disk drives into a server running Windows Server 2012. You want to create a volume that will
Anuta_ua [19.1K]

Answer:

<em>New RAID-5 Volume </em>

Explanation:

RAID 5 <em>is a superfluous assortment of setup of independent disks using parity disk striping. </em>

Because all the disks display data and parity evenly, no single disk is a limiting factor. In the event of a disk failure, striping will also allow users to rebuild data.

RAID 5 classes have at least three and no maximum hard disk drives (HDDs). RAID 5 is deemed among the most stable RAID setups because the parity information is distributed across all drives.

5 0
3 years ago
What is a WYSIWIG program
jeyben [28]

Answer:

WYSIWYG means "what you see is what you get ".

Explanation:

It is type of editor or program that helps while creating a document. This program allows us to see the end result while creating a document i terms of who document will look like after completion.

4 0
3 years ago
In which encryption strategy is the plaintext encrypted one character at a time and each encrypted character depends on that sin
Natasha_Volkova [10]

Answer:

Caesar cipher

Explanation:

In formation technology, cryptography or cryptology is a process of coding or encrypting information, using algorithms and input values in a network, where there is a present of a third party called adversaries or attackers.

There are different types of cryptography, namely, symmetric, assymmetric and hash cryptography.

Ciphers are algorithms used in cryptography to encode (encrypt) or decode (decrypt) information. An example of cipher is the Ceasar's cipher.

Ceasar cipher is a simple type of substitution cipher that encrpts plain text one character at a time and each coded character depends on the single character and a fixed distance value.

4 0
3 years ago
Other questions:
  • Which is NOT a type of SD card?
    8·2 answers
  • What is the primary purpose of a business plan? To file for incorporation To help you identify your goals and plan how you will
    6·1 answer
  • 1.The small company where you work needs to implement a second server for its accounting system but does not have the funds to p
    15·1 answer
  • how can you repin an image on your Pinterest pin board A. click on the "repin" button B. click on the "add pin" button C. click
    7·2 answers
  • Which statement about word processing software is true?
    11·1 answer
  • What does an operating system do?
    11·2 answers
  • Consider the following code which deletes all the nodes in a linked list. void doublyLinkedList::destroy() { nodeType *temp; //p
    14·1 answer
  • A Color class has a constructor that accepts three integer parameters: red, green and blue components in the range of 0 ... 255
    6·1 answer
  • What is the force that resists the motion of an object through a fluid?
    6·1 answer
  • A small business utilizes a SOHO router and wishes to secure its existing wireless infrastructure. The business has fewer than t
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!