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
Choose the type of collection described.
Stella [2.4K]

Answer:

1) List

2) Dictionary

3) Tuple

Explanation:

A list uses square brackets. It is used to store multiple items in just one variable. They are usually changeable and give room for duplicates. You use append to add to the collection.

A dictionary uses curly brackets. You use update to add to the collection. A dictionary is created by placing the elements in curly brackets and separating them with a comma. It is changeable and it does not give room for duplicates.

A tuple uses parentheses. You cannot change it once you create it. It is an ordered list of elements that is finite and can also store multiple items in one variable.

7 0
2 years ago
Jana works in a call center helping people who are having trouble setting up their
olchik [2.2K]

Answer:

Information Support and Services

Explanation:

She works helping people setting up their accounts so she supports with information from her services

4 0
3 years ago
Read 2 more answers
The Next Einstein Initiative and the ________ Institute for Mathematical Sciences bring bright young learners and the best lectu
Degger [83]

Answer:

The correct answer is B. Africa

Explanation:

African Institute for Mathematical Sciences (AIMS) was founded in 2003 having its first center in Cape Town, South Africa. AIMS provides training for Africa's talented university graduates needed to enter technical professions or pursue graduate studies in technical fields. The Next Einstein Initiative (NEI) is a strategic plan to build on the success of the first AIMS centre and create a coordinated pan-African network of 15 AIMS centres by 2020, producing 750 well-qualified graduates per annum. AIMS won the Google's Project 10^100 and also the founder of AIMS won the TED Prize and announced his vision to unlock scientific talent across Africa.

5 0
3 years ago
Source ________ contains instructions written by a programmer specifying the actions to be performed by computer software.
konstantin123 [22]

Source code contains instructions written by a programmer specifying the actions to be performed by computer softwa

7 0
2 years ago
An initialization expression may be omitted from the for loop if no initialization is required.
stealth61 [152]

Answer:

True

Explanation:

for loop is used to repeat the process again and again until the condition not failed.

syntax:

for(initialize; condition; increment/decrement)

{

    Statement

}

But we can omit the initialize or condition or increment/decrement as well

the syntax after omit the initialization,

for( ; condition; increment/decrement)

{

    Statement

}

The above for loop is valid, it has no error.

Note: don't remove the semicolon.

You can omit the condition and  increment/decrement.

and place the semicolon as it is. If you remove the semicolon, then the compiler show syntax error.

5 0
3 years ago
Other questions:
  • Put the following numbers in order from greatest to least:
    13·1 answer
  • A user makes a request to implement a patch management service for a company. As part of the requisition the user needs to provi
    7·1 answer
  • Evolution of computers
    13·2 answers
  • Why is there no I do you time of day when all students should study
    10·1 answer
  • I'd: 9872093250, password: qqqqq, join the meeting​
    11·1 answer
  • You are network administrator for an Active Directory forest with a single domain. Then network has three sites with one domain
    12·1 answer
  • Micheal is the project manager in a company. He wants his organization to use technology for higher revenue and productivity. Wh
    13·1 answer
  • Match each example to the type of component, either Input, Process, or Output.
    12·1 answer
  • Instruction: Decide what the total marketing budget will be, and make a list of at least four things you will spend money on and
    15·1 answer
  • What safety do you need to have ready to start a device repair?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!