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
Kolom terakhir pada lembar kerja Excel 2019 adalah​
elixir [45]

Answer:

Tahan CTRL dan tekan tombol panah kanan (tombol kursor) pada keyboard. Anda dibawa ke kolom paling kanan. Dalam versi Excel modern, ini adalah kolom XFD, yaitu 16.384 kolom. Di versi Excel yang lebih lama (2003 dan sebelumnya) kolom terakhir adalah IV yaitu 256 kolom.

in english

Hold down CTRL and press the right arrow key (cursor key) on the keyboard. You are taken to the right-most column. In the modern versions of Excel this is column XFD, which is 16,384 columns. In older versions of Excel (2003 and prior) the last column was IV which is 256 columns.

3 0
3 years ago
. simulation programs can use a range of integer values to mimic variability in the simulation. a. true b. false
RSB [31]

True, simulation programs can use a range of integer values to mimic variability in the simulation.

What are simulation programs ?

The foundation of simulation software is the process of simulating a genuine phenomena using a set of mathematical equations. In essence, it's a program that enables the user to simulate a process while still observing it in action.
It is theoretically possible to simulate on a computer any phenomenon that can be reduced to numerical values and equations.
Identifying the most crucial elements that have an impact on the simulation's objectives is one of the tricks to creating useful simulations.

Therefore, simulation programs can use a range of integer values to mimic variability in the simulation.

You can learn more about simulation programs from the given link:

brainly.com/question/27159343

#SPJ4

5 0
2 years ago
Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
Ratling [72]
I would imagine car would still be the best means , it's tough to define without knowing where he lives and how much he travels
8 0
4 years ago
What are the arguments both for and against the exclusive use of Boolean expressions in the control statements in Java (as oppos
dezoksy [38]

Answer:

The correct answer to the following question will be "Primary argument".

Explanation:

The primary argument for the use of Boolean operators or expressions exclusively as regulation expressions seems to be the flexibility resulting from forbidding for the above usage a broad variety of styles.

  • For illustration, in C some statements of a certain sort may present as a command statement so that the compiler sometimes doesn't recognize irregularities in grammatical mistakes that resulted in links to a variable of inappropriate forms.
4 0
3 years ago
To change the style of the table, utilize the _________Tab. To change the layout of the table, choose the________ Tab.
Bogdan [553]
To change the style of the table, utilize the Table Design tab. To change the layout of the table, choose the Table Layout tab.
8 0
4 years ago
Other questions:
  • What is a project manager?
    6·2 answers
  • A card ____ is a device that reads data, instructions, and information stored on flash memory cards.
    8·1 answer
  • What is the khan academy game where it is a block having to jump over lava and is an endless runner
    9·1 answer
  • A program is a high-level one that has been converted to machine language
    15·1 answer
  • arlos, an algebra teacher, is creating a series of PowerPoint presentations to use during class lectures. After writing, formatt
    12·2 answers
  • A user is having an issue updating an app from Windows Store. Where you go to find more information on the error?
    14·1 answer
  • How is communication within healthcare different than communication within other industries ?
    13·1 answer
  • 4. True or False: In order to use wi-fi signal/network, you have to remain seated in one spot.
    6·1 answer
  • Which describes the "Network Effect?
    10·1 answer
  • Two examples that cannot be performed by humans and that computers are used for instead​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!