subject

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
import java. util. Scanner;
import java. io. PrintWriter;
import java. io. StringWriter;

public class StringStreamOutput {
public static void main (String [] args) {
Scanner scnr = new Scanner(System. in);
String userItem = "";

StringWriter itemCharStream = new StringWriter();
PrintWriter itemsOSS = new PrintWriter(itemCharStream);

System. out. println("Enter items (type Exit to quit):");
userItem = scnr. next();

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

/* Your solution goes here */

userItem = scnr. next();
}

userItem = itemCharStream. toString();
System. out. println(userItem);

return;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
You know the right answer?
Write code that inserts userItems into the output string stream itemsOSS until the user enters "Exit...
Questions
question
Computers and Technology, 19.10.2021 01:00
question
Mathematics, 19.10.2021 01:00
question
Mathematics, 19.10.2021 01:00
Questions on the website: 13722367