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
To make a complicated task easier, use a _____.
tia_tia [17]
I believe the answer is B spread sheet because i use spread sheets to make my life easier. I organize info in a spread sheet then it is really easy to find.

hope this helps<span />
6 0
3 years ago
Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list and then dis
Aleksandr-060686 [28]

Answer:

The following are the program in the Python Programming Language.

#declare the list  

lst=[]

#set the for loop  

for num in range(1,21):

 #get the element of the list from the user

 n=int(input('Enter the {} element :' .format(num)))

 #add elements in the list

 lst.append(n)

print()

#print the minimum number in list

print('The lowest number in the list: ',min(lst))

#print the maximum number in list

print('The highest number in the list: ',max(lst))

#print the total of the list

print('The total of the numbers in the list: ',sum(lst))

#print the average of the list

print('The average of the numbers in the list: ',sum(lst)/len(lst))

<u>Output</u>:

Enter the 1 element :53

Enter the 2 element :65

Enter the 3 element :41

Enter the 4 element :23

Enter the 5 element :21

Enter the 6 element :12

Enter the 7 element :96

Enter the 8 element :85

Enter the 9 element :74

Enter the 10 element :98

Enter the 11 element :75

Enter the 12 element :41

Enter the 13 element :54

Enter the 14 element :56

Enter the 15 element :36

Enter the 16 element :25

Enter the 17 element :14

Enter the 18 element :12

Enter the 19 element :45

Enter the 20 element :65

The lowest number in the list:  12

The highest number in the list:  98

The total of the numbers in the list:  991

The average of the numbers in the list:  49.55

Explanation:

<u>The following are the description of the program</u>.

  • Firstly, we declare the empty list type variable 'lst' to store elements.
  • Then, set the for loop statement that iterates from 1 and end at 20.
  • Then, set a variable that get elements of the list from the user and appends those user defined inputs in the list type variable 'lst'.
  • Finally, print the lowest and the largest elements in the list as well as print the total and average of the elements in the list.
6 0
3 years ago
The term “digital divide” refers to the gap between
juin [17]
It is the gap between demographics and regions.
4 0
3 years ago
Sends a copy of the message and any additional comments to a different e-mail address
Debora [2.8K]

Answer:

Forward.

Explanation:

E-mail is an acronym for electronic mail and it can be defined as a set of written words, texts, characters used for conveying a message from one person to another. It is a channel or medium of communication between one person and the other.

Forward simply sends a copy of the message and any additional comments to a different e-mail address. The term forward is used in email to describe the process of sending a message.

3 0
3 years ago
You have a certificate that you want to convert into digital form, what kind of device would you use? *
ryzh [129]

Answer:

Scanner.

Explanation:

In this scenario, you have a certificate that you want to convert into digital form, the kind of device you would use is a scanner.

When scanners and digital cameras are used to capture images that are uncompressed or minimally processed image file, it is known as a RAW image file.

Generally, this file type are usually very large in size because of their lossless quality and does not have any alteration and as such have not been processed; thus, cannot be printed

3 0
3 years ago
Other questions:
  • Some financial institutions can be really bad about putting unexpected charges
    12·1 answer
  • By generating and delivering timely and relevant information supported by networks, _____ creates new opportunities for conducti
    15·1 answer
  • How do you uninstall sc update?
    13·2 answers
  • In Word, blue underlining indicates which of these problems?
    12·1 answer
  • A research team is studying parallel computing. They want to run parallel process without having to use multiple processors. How
    7·1 answer
  • Who found the first computer bug in 1947, and invented the concept of a compiler in 1952
    6·1 answer
  • the outline view allows you to control how much information you can see in a document, because you can expand or collapse sectio
    12·1 answer
  • List any two different between primary memory and secondary memory.​
    8·2 answers
  • Selecting missing puppies 1 # Select the dogs where Age is greater than 2 2 greater_than_2 = mpr [mpr. Age &gt; 2] 3 print(great
    8·1 answer
  • What does CPU stand for
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!