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]
2 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]2 years ago
4 0
If you're a zybooks user.

itemsOSS.print(userItem + " "); 
      userItem = itemCharStream.toString();
GenaCL600 [577]2 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
When did Microsoft released MS-Word 2016? S When did Microsoft released MS - Word 2016​
Pepsi [2]

Answer:

July 9, 2015

Explanation:

It was released on macOS on July 9, 2015, and on Microsoft Windows on September 22, 2015, for Office 365 subscribers. Mainstream support ended on October 13, 2020, and extended support for most editions of Office 2016 will end on October 14, 2025, the same day as Windows 10.

3 0
1 year ago
What can help you take better animal photographs?
pshichka [43]

Answer:

All of the above

Explanation:

i think i may be wrong.

7 0
3 years ago
Read 2 more answers
You configured the IP address and DNS name of a new internal web server named WEB3. Your first test from a web browser on your w
bonufazy [111]

Answer:

I would reset the Domain Name System (DNS)

Explanation:

One factor that could lead to the "Site Cannot Be Reached" error is DNS "poisoning". Another is invalid DNS cache. Both can be caused by an attack on the system by people trying to spoof the system. Spoofing ensures that even when the right address is entered, it leads one to another web address.

One way to quickly reset the DNS is to run ipconfig /flushdns

This helps to clear the DNS cache.

Once the DNS cache has been successfully flushed, the system returns a confirmatory message that reads “flushed the DNS resolver cache”.

The systems administrator can now proceed to reconfigure the IP address(es)

Cheers

3 0
3 years ago
The variables xp and yp have both been declared as pointers to integers , and have been assigned values (i.e., they are each poi
Amanda [17]

Answer:

Following code are:

int *temp;   //declaration of variable

// perform swapping

temp = xp;    

xp = yp;

yp = temp;

Explanation:

we declare an integer data type pointer variable "*temp"  then perform swapping between them.

The variables "xp" and "yp" are already declared and these variables are performing swapping among three.

6 0
3 years ago
Why is it preferable to code web pages in html format?
Ronch [10]
Depends on what you are working on.

If you are working on a website I recommend Adobe Dreamweaver CC.

if its small assignments that doesnt involve major work, I'd use something like notepad++
8 0
3 years ago
Read 2 more answers
Other questions:
  • Show the printout of the following code.
    14·1 answer
  • What does the hard disk drive do? It stores all of the information on a computer. It controls a computer’s operating system. It
    12·2 answers
  • At your job, you often have to address letters to the customer support manager, Tyson Kajewski. The problem is that you are cons
    9·1 answer
  • The ____ contains the computer's "brain," the central processing unit (CPU).
    5·2 answers
  • Write a python program that requests a word (with lowercase letters) as input and translates the word into pig latin. The rules
    15·2 answers
  • Almost all application programs are designed to run with a specific platform. Group of answer choices True False
    15·1 answer
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    12·1 answer
  • An ink-jet printer is a type of impact printer. <br> a. True <br> b. False
    8·1 answer
  • Primary functions of lighting are sufficient light to...
    13·1 answer
  • This function chooses the screen to display based on the score.What is the correct way to call this function?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!