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
goldfiish [28.3K]
3 years ago
12

Java - Given a String variable response that has already been declared, write some code that repeatedly reads a value from stand

ard input into response until at last a Y or y or N or n has been entered.
ASSUME the availability of a variable, stdin , that references a Scanner object associated with standard input.
Computers and Technology
1 answer:
Rainbow [258]3 years ago
4 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

   

    Scanner stdin = new Scanner(System.in);

    String response = "";

 while (true) {

     System.out.print("Enter the response: ");

     response = stdin.nextLine();

     

     if (response.equals("Y") || response.equals("y") || response.equals("N") || response.equals("n"))

         break;

 }

}

}

Explanation:

Create a string variable called response

Create a while loop that iterates until a condition is specified to stop

Inside the loop:

Ask the user for the input

Check if input equals "Y", "y", "N" or "n". If input equals any of these letters, stop the loop. Otherwise, continue asking for a new response

You might be interested in
Consider the following code: <br> x=9 y = -2 z=2<br> print (x + y * z)<br> What is output?
Goryan [66]

Answer:

14

Explanation: The reason why is because adding a negative is pretty much subtracting by 2. 9-2=7. Then multiply 7 by 2 like add 7 to 7 and you get 14.

3 0
3 years ago
How will wireless information appliances and services affect the business use of the Internet and the Web? Explain.
Paraphin [41]

Answer:

wireless information appliances and services affect the business use of the internet and the web in a positive way. Wireless information appliances and services affect the business use of the web and internet by allowing internet pretty much anywhere. Now days devices like cell phones can access almost everything a regular computer can access. The use of wireless information allows businesses to stay in constant contact with customers, employees, and suppliers.

3 0
3 years ago
Use the table on the right to convert from decimal to hexadecimal.
leva [86]

Answer:

what is the question and answers?

3 0
3 years ago
Read 2 more answers
If i cl/ear ch/at hist/ory on group/me on my comp.uter will it clear it on my phone
leonid [27]

Answer: It is likely that this can happen.

Explanation:

If you really want to go the extra mile to clear it all, I may recommend that you clear it off the phone as well. Hope this helps.

6 0
3 years ago
Read 2 more answers
A Windows user contacted the help desk with a problem that requires the technician to connect to the remote computer using Remot
Yuri [45]

Answer:

Option 4 i.e., RDP, port 3389.

Explanation:

The User has informed the helpdesk with such an issue that involves the specialist to link to the remote server utilizing Remote Assist to access the user's screen with a quite informative and ambiguous error. Every attempt made by the technician to link to the virtual server outcomes in a message saying that the link has been denied.

So the combinations of RDP and port 3389 would be enabled on the remote computer’s firewall to allow this connection.

6 0
3 years ago
Other questions:
  • A personal phone directory contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the
    15·1 answer
  • A is a way for students to keep track of information during research
    5·1 answer
  • What processes are needed to transform a c++ program to a machine language program that is ready for execution?
    14·1 answer
  • Use HTML to create a web page
    10·1 answer
  • What is a feature of webmail
    13·1 answer
  • Problem: Mr. James Reid, the director of admissions at MOGCHS University, has
    14·1 answer
  • What are the qualities of different products that caught your eye and encourage you to buy them​
    12·1 answer
  • Kitchen Gadgets
    10·1 answer
  • What is the relationship between agile teams and project requirements
    9·1 answer
  • Please please help I don’t understand this
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!