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
What are informational sessions?
arsen [322]

Answer:B

Explanation:

7 0
3 years ago
In Rizzati Corp, vice presidents in departments such as engineering, manufacturing, IT, and human resources report directly to t
Harrizon [31]

Answer: <em>Functional organizational structure.</em>

Explanation:

From the given case/scenario, we can state that Rizzati Corp has a functional organizational structure. Functional organizational structure is referred to as a structure which is used in order to organize employees. The employees are mostly grouped or organized based on their knowledge or specific skills. It tends to vertically structure each and every department or staff with specific roles from VP to sales and finance departments, to worker assigned to commodities or services.

7 0
3 years ago
Which of the following information is okay to share on social networking site?
zvonat [6]
C. Your hobbies and interests
4 0
3 years ago
Read 2 more answers
Function Integer cube(Integer num) Return num * num * num End Function Write a main module that contains a statement that passes
Klio2033 [76]

Answer:

#include <iostream>

using namespace std;

int cube(int num)//function cube..

{

   return num*num*num;

}

int main() {

   int result=cube(4);//result stores the value of cube(4).

   cout<<result;//displaying it to the screen.

return 0;

}

Explanation:

The above code is in C++ language.The function cube is passed with value 4 and the result of it is stored in the variable result of integer type.Then the result is displayed using the cout. Which is used to print the statement to the output screen.

5 0
3 years ago
Select the correct answer.
kicyunya [14]

Answer:

D

Explanation:

pecialisation - departments focus on one area of work. productivity - specialism means that staff are skilled in the tasks they do. accountability - there are clear lines of management. clarity - employees understand their own and others' roles.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Sam has sent Sally an email. Sally wants to answer him without manually typing in his email address. Which email option should s
    12·2 answers
  • Can a percent be used in a filename?
    13·1 answer
  • A) What is the maximum value that can be represented as an unsigned n-bit binary integer?
    13·1 answer
  • Keyboards that are widely used on various smartphones and other small portable devices, and which are designed primarily for com
    15·1 answer
  • The marketplace is the essence of which of the following?
    11·1 answer
  • What is the term for the era created by the digital revolution?
    5·1 answer
  • How many comparisons will be done to find 8 in this list using a linear search?
    8·1 answer
  • Write an algorithm for finding the perimeter of a rectangle
    6·1 answer
  • 100 points for this and brainlyist lol
    11·1 answer
  • Write a function solution that given an array a of n integers (between -100 and 100), returns the sign (-1,0,1) of product of al
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!