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]
2 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]2 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
Bad Directions You are driving to your friend’s house and are using your smartphone for directions. While approaching your desti
Helen [10]

This could have happened when:

  • Lack of Internet service or failure
  • Wrong application.
<h3>What do you mean by Internet?</h3>

The Internet is seen as a form of a network that helps people to  connects their computers all over the nation.

In this age,  Through the help of the Internet, people are able to  share information and navigate through places.

Note that the problem of bad direction could have happened when:

  • Lack of Internet service or failure
  • Wrong application.

Learn more about Internet from

brainly.com/question/2780939

#SPJ1

6 0
1 year ago
A(n) _______ is the most basic type of access query
san4es73 [151]
Select Query
I hope this helps! :)
4 0
2 years ago
You have a manager who makes decisions without getting input from anyone. They are unwilling to change anything once a decision
saw5 [17]

Answer:

autocratic

Explanation:

taking no account of other peoples wishes or opinions; domineering

3 0
2 years ago
JOIN GO.OGLE CLASSROOM IF YOUR A FAN OF FRANK OCEAN
Mrrafil [7]
Yes i agree perfectly
3 0
2 years ago
Read 2 more answers
The recommended flux for electrical soldering is A. antimony. B. sal ammoniac. C. rosin. D. muriatic acid.
expeople1 [14]
I pretty sure its D muriatic acid
3 0
3 years ago
Other questions:
  • A(n) ____ backup only archives the files that have been modified since the last backup.
    11·1 answer
  • Debugging is not testing, but always occurs as a consequence of testing. <br> A) TRUE<br> B) FALSE
    13·1 answer
  • “When using a public computer for browsing the Internet, try to use for 1.________ transactions. Also, use 2.__________ browsing
    10·2 answers
  • Imagine your friend wants to apply
    5·1 answer
  • There are many different types of decision-making. Which of the following is NOT a type of decision-making? a. fiat rule b. sing
    15·2 answers
  • What are the differences between a trap (aka software interrupt) and an interrupt (hardware interrupt)? What is the use of each
    12·1 answer
  • List five application programs you recommend, and write a sentence explaining why.
    9·1 answer
  • Two parter:
    11·1 answer
  • 2. what are the advantages of breaking up a single logical message into a number of fixed-sized packets and then sending each on
    5·1 answer
  • What is malware? What are some signs that malware may be impacting the performance of your computer? How can you avoid malware?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!