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
Which type of image is not a supported using the Online Pictures or Insert Picture command?
IgorC [24]

Answer:

HTML  i think

Explanation:

4 0
3 years ago
Read 2 more answers
Have a great day!
valina [46]

Answer:

thank you so much!

Explanation:

you seem like such a nice person! have a great weekend!

5 0
2 years ago
Read 2 more answers
In two to three paragraphs, come up with a way that you could incorporate the most technologically advanced gaming into your onl
Marina CMI [18]

nobody cares about plagiarism dude

7 0
3 years ago
select the correct answer from each drop-down menu. “To clean a computer screen, use ___. To clean a keyboard, use a ___.”
ivanzaharov [21]

Answer:

screen - soft cloth

keyboard - paintbrush

6 0
2 years ago
Which type of software is created on user dimension​
Ratling [72]

Answer:

Application and system software is created on user dimension.

6 0
2 years ago
Other questions:
  • What is the best overall approach to education and career development for IT professionals?
    14·1 answer
  • The use of computers to combine data from multiple sources and create electronic dossiers of detailed information on individuals
    8·1 answer
  • This measures how close a biometric reading is to a prerecorded template
    11·1 answer
  • Its a zoom call
    7·1 answer
  • __________ refers to rules, statutes, codes, and regulations established to provide a legal framework within which business may
    13·1 answer
  • Which turn best describe news one is connected to the government and is used as a political tool more than as a business product
    12·1 answer
  • BEING TIMED HELP ASAP
    12·2 answers
  • The ability to use various design software such as Adobe Photoshop, InDesign, and Illustrator would be MOST beneficial to which
    6·1 answer
  • How will you maintain electrical tools and equipment?
    12·2 answers
  • TECHNICAL TERMS: the adderess of a website
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!