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
How do we call a very small video,that is repeating unlimitedely
labwork [276]
A very small video that is continuous is called a GIF, which stands for Graphics Interchange Format.

 
3 0
3 years ago
Read 2 more answers
__________ is a single set of hardware, databases, networks, people, and procedures configured to collect, manipulate, store, an
sergiy2304 [10]

Answer:

Computer-based Information System

Explanation:

According to my research on information technology, I can say that based on the information provided within the question the term being described is called a Computer-based Information System (CBIS). This is (like mentioned in the question) a data processing system into a high-quality information and can be used to support decision-making, coordination and control as well as visualizing and analyzing data.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
4 years ago
....is an act of introducing an invention into market on business basis for profit​
jonny [76]

Answer:

Entrepreneurship

Explanation:

6 0
3 years ago
Assume that d is a double variable. Write an if statement that assigns d to the int variable i if the value in d is not larger t
mamaluj [8]

Answer:

That's because the value has reached the size limit of the int data type. ... you should use long rather than int , because long can store much larger numbers than int . If ... In other words, a float or double variable can't accurately represent 0.1 . ... If you're using Java to measure the size of your house, you'd need an electron ...

Explanation:

3 0
3 years ago
What is the result of a network technician issuing the command ip dhcp excluded-address 10. 0. 15. 1 10. 0. 15. 15 on a cisco ro
Hunter-Best [27]
The answer to this question is 83774838473773
3 0
2 years ago
Other questions:
  • The letters G,S and C are all examples of what Microsoft Word feature?
    12·1 answer
  • Difference between alt tab and windows tab
    15·1 answer
  • In many cases, a subquery can be restated as a/an ______________.
    13·1 answer
  • Use the Internet to gather information on four filesystems compatible with Linux. For each filesystem, list the situations for w
    12·1 answer
  • When photographing wildlife, what type of lighting should you use?
    15·2 answers
  • Is open office compatible will all web browsers without requiring a plug in?
    8·1 answer
  • HELP ME IF YOU KNOW HOW TO CODE ON PYTHON <br> ITS FOR A TEST DUE IN A FEW MINUTES
    12·1 answer
  • 1, and
    9·1 answer
  • _________________ component defines the correct granularity for access controls and oversees the relationships between identitie
    13·1 answer
  • Kelly arrives for work at a restaurant at 5:00 p.m. Once there, she washes and chops vegetables, then sets aside ingredients and
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!