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
Question 2 of 5
goblinko [34]
B. Find one or two co-workers that you can complain to.
3 0
3 years ago
The ____ aggregate function finds the largest value
NemiM [27]
The MAX aggregate function.

MAX aggregate function returns the maximum value of an expression over a group of rows. It can be used as an analytic or an aggregate function. Aggregate function MAX can operate with Boolean values or can be converted to a Boolean.



6 0
3 years ago
_____ remove the part of an image starting from an edge​
Lapatulllka [165]
I think it’s cropping could be wrong though
4 0
3 years ago
Use the Law of Sines to solve the triangle. Round your answers to two decimal places.
iris [78.8K]

Answer: 37.1

Explanation: The Law of sines states that there is a proportionality between a side of triangle and its correspondent angle, i.e.:

\frac{a}{sinA} = \frac{b}{sinB} = \frac{c}{sinC}

where:

a, b and c are sides

A, B and C are angles

In the question, there is a triangle with 27.4 as a measure of side a, angles A and C. So, it wants the side c:

\frac{a}{sinA} = \frac{c}{sinC}

\frac{27.4}{sin(99.7)} = \frac{c}{sin(20.4)}

c = \frac{27.4.sin(20.4)}{sin(99.7)}

c = 37.1

The side c is 37.1

5 0
3 years ago
While there are a some exceptions such as an if-statement, Scheme has one primary syntax () a) True b) False
aivan3 [116]

Answer:

Hence the answer is False.

Explanation:

While there are some exceptions such as an if-statement, the scheme has one primary syntax (<thing I want to do> <things I want to do it to>).

The given statement is False.

4 0
3 years ago
Other questions:
  • Which rock band apologized for automatically adding its new album to every iPhone 6 in 2014
    8·2 answers
  • Why does people that gets abused not report?
    5·1 answer
  • Which of the following cannot be performed from the windows task manager?
    15·2 answers
  • The difference between a want and a need is a want is not necessary for survival. Things necessary for survival are known as ___
    6·1 answer
  • In which of the following scenarios would it be best to use a for loop?
    6·1 answer
  • An Internet Service Provider (ISP) is a company that builds the routers and wired connections that allow individuals to access t
    12·2 answers
  • The Fibonacci numbers are the numbers
    15·1 answer
  • How might a company go about performing a load test on their website?
    7·1 answer
  • A database administrator (DBA) must have a clear understanding of the fundamental business of an organization, be proficient in
    12·1 answer
  • Normalization works through a series of stages called normal forms. For most purposes in business database design, _____ stages
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!