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
Hoochie [10]
3 years ago
14

Java write code that inserts useritems into the output string stream itemsoss until the user enters "exit". each item should be

followed by a space. sample output if user input is "red purple yellow exit": red purple yellow
Computers and Technology
2 answers:
Step2247 [10]3 years ago
4 0
If you're a zybooks user.

itemsOSS.print(userItem + " "); 
      userItem = itemCharStream.toString();
GenaCL600 [577]3 years ago
4 0

For the given problem, first read the input from console using scanner class. Then print the input into the print writer and scan the next word using the scanner. This will continues until we did not get ‘Exit’ word. The loop will terminate when user enter exit. Now, append the text and print the string.  

Further Explanation:  

Code: The below Java code that inserts the user items into output stream items until the user enters “exit”.  

// Scanner class to take input from the keyboards

import java.util.Scanner;  

//Enables to find the characters written to a writer as a string

import java.io.StringWriter;  

// Used to print the objects in text-output stream

import java.io.PrintWriter;  

//class definition

public class UserInputsOutputs

{  

   public static void main (String [] args)  

   {  

//Scanner class to read the input  

        Scanner scan = new Scanner(System.in);  

        String userItem = "";  

// printwriter to print items on the console.  

        StringWriter itemCharStream = new StringWriter();  

        PrintWriter stringItems = new PrintWriter(itemCharStream);  

        System.out.println("Enter items (type Exit to quit):");  

        userItem = scan.next();  

// Loop terminates when user enter Exit  

        while (!userItem.equals("Exit"))  

        {  

            stringItems.append(userItem+" ");  

            userItem = scan.next();  

        }  

        userItem = itemCharStream.toString();  

// Display the string  

        System.out.println(userItem);  

        return;  

   }  

}  

Learn more:  

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011    

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832    

3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. brainly.com/question/7866623  

Answer details:  

Grade: College Engineering  

Subject: Computer Science and Engineering  

Chapter: Java Programming  

Keyword:  

Java, programming, console, user, items, string, append, string, writer, scanner, input, output, red, purple, yellow, stream, print, next, loop, while, for, if else statement, println  

You might be interested in
What symbol is used for an assignment statement in a flowchart?
Annette [7]

Answer:

processing

Explanation:

The flow chart is a diagram that shows the activity of the program, peoples or things.

Flowchart symbol and meaning in the options:

1. Processing: it is a rectangular shape block which is used for variable declaration or assignment.

2. I/0: it is a parallelogram in shape which is used for input or output.

3. Parallelogram: it is used for input or output.

4. diamond: it is used for decisions or conditions.

Therefore, the correct option is a. Processing is the one that is used for the assignment statement.

3 0
4 years ago
Which type of storage disk and disk drive can you use in the given situation?
Margarita [4]

Answer:

The answer to this question is DVD and DVD-RW

Explanation:

6 0
3 years ago
How are gems and precious metals similar?
Ierofanga [76]
The answer would be d they are both rare and valuable minerals
7 0
3 years ago
Read 2 more answers
Hi, I just ate a hot banana that I cooked in the oven.
mrs_skeptik [129]
Banana fish .. pain. all i know is pain.
4 0
3 years ago
Read 2 more answers
Michael is discussing various project needs with his team. Match Michael's statement with the way project management can help th
VashaNatasha [74]

Answer:

"We need to maintain a performance standard for the processes in the project." - <em>managing quality</em>

"There can be certain threats or problems during project execution. We need to handle them." - <em>managing risks</em>

"The client needs some additional requirements in the project. We need to accommodate them." - <em>managing change</em>

"The project activities are getting chaotic. We need to manage them efficiently." - <em>organizing activities</em>

Explanation:

Project management can help Michael manage all these needs that he and his team have. Project management is the application of skills and tools to a particular project. This requires certain knowledge and techniques in order to ensure that the project requirements are properly met. Project management does not generally deal with a whole company at once. Instead, a project is a temporary situation, and it needs to be completed within a specific timeframe. It also means that such a project has a defined scope and resources, which make efficient management even more important.

5 0
3 years ago
Other questions:
  • By default, a word document generally displays in ____ view.
    9·1 answer
  • Semiconductors are only somewhat conductive electronic components.<br><br> True or False?
    14·1 answer
  • I’m nobody. Who are you?
    9·2 answers
  • Along with an ip address, a subnet mask, and a name server, the other thing required for a computer to operate on a network is a
    15·1 answer
  • Develop a list of privacy protection features that should be present if a website is serious about protecting privacy. Then, vis
    8·1 answer
  • What is emerging as a major business area of innovation that offers a flexible collection of computers on the internet that can
    6·1 answer
  • What are the four stages a customer goes through when buying a product?
    7·2 answers
  • Whats your favorite .io game (example krunker.io, gawd.io)<br> (PS FWEE PTS BOIS)
    7·1 answer
  • Why is it essential for every person living in the 21st century to have a computer​
    9·1 answer
  • From the time users first visit a new website, or view a new media piece, how much time will they spend on the site before they
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!