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
abruzzese [7]
2 years ago
15

In JAVA, answer the following:

Computers and Technology
1 answer:
erica [24]2 years ago
7 0

Answer:

The JAVA program is as follows.

import java.util.Scanner;

public class Program

{

   static int n;

public static void main(String[] args) {

    //scanner object

    Scanner stdin = new Scanner(System.in);

    //loop executes till number entered is in the range of 1 to 10

    do

    {

        System.out.print("Enter any number: ");

        n = stdin.nextInt();

    }while(n<1 || n>10);

    System.out.println("Number is valid. Exiting...");

}

}

OUTPUT

Enter any number: 0

Enter any number: 23

Enter any number: 10

Number is valid. Exiting...

Explanation:

The program is explained.

1. The integer variable, n, is declared static since the variable should be accessible inside main() which is static.

2. An object of Scanner, stdin, is created inside main().

3. Inside do-while loop, the user is asked input any value for n.

4. The loop continues till user inputs a number which is not in the given range, beginning from 1 to 10.

5. The loop will not be terminated till the user enters a valid input.

6. Once a valid input is entered, the message is displayed to the console and the program ends.

7. The variable, n, is declared at the class level and is a class variable. Class variables are declared inside the class but outside all the methods in that class.

8. Since JAVA is a purely object-oriented language, all the code is written inside class.

9. The object of class is not created since only one class is included in the program. If more than one class is included, then the object of the class which does not has the main() method will be created inside main().

10. User input for integer is taken via scanner object and using nextInt() method.

11. The methods, print() and println() display the messages to the console. The only difference is that println() inserts a new line after displaying the message.

12. The name of the class having main() and the name of the program should be the same.

You might be interested in
Answer the question ASAP please
RUDIKE [14]

Answer:

Shows the programming checking if num1 is greater than num2

Explanation:

So num1 and num2 are inputs

for you to code this you would need to put

num1=int(input("What is your first number? ))

and the same for num2 except change num1 for num 2 and first for second

When the input is completed, the computer will check if num 1 is greater than num2

it will do this by using a code something like:

if num1>num2:

    Print("Your first input was greater than your second")

But in this example if it greater it just ends

But if it was less than you would put

if num1>num2:

    Print("Your first input was greater than your second")

elif num1<num2:

    Print("Your first input is less than your second")

So basically this code shows the computer checking if one number is greater than the other or not

3 0
2 years ago
Read 2 more answers
Prior to the world wide web as we know it today, the internet was chaotic, without any ____.
atroni [7]
Search engines - there was no single way to ask a question
5 0
3 years ago
A _____ is a character or group of characters that has a specific meaning. a. field b. record c. file d. database
zubka84 [21]

A character or collection of characters with a specific meaning is called a field.

<h3>What does the technical term "field" mean?</h3>

A field is a purpose-driven, typically fixed-sized section in a fixed or known location within a unit of data, such as a record, message header, or computer instruction. A field may be divided into smaller fields depending on the situation.

<h3>What does a file structure field mean?</h3>

A record is an entire set of fields, a field is a single piece of information, and a file is a collection of records. An analogy between a file and a phone book is a phone book. There is a list of records in it, and each record has three fields: a name, an address, and a phone number.

learn more about field here  

<u>brainly.com/question/28002617</u>

#SPJ4

8 0
1 year ago
Everybody at a company is assigned a unique 9 digit ID. How many unique IDs exist?
Brut [27]
If you include all zeroes, then it should be 1,000,000,000. Otherwise it’s 999,999,999.

Think of how between 0-9 theres 10 numbers, and use that logic towards 000000000-999999999
3 0
3 years ago
A personal computer uses a number of chips mounted on a circuit board called
Vesnalui [34]
The answer is d.mother board 

7 0
2 years ago
Other questions:
  • Explain the difference between an i/o‐bound process and a cpu‐bound process.
    12·1 answer
  • Which of the following is likely the cause of the bass from a sound system rattling the windows on your car?
    11·1 answer
  • In several languages, the visual development environment is known by the acronym ____.
    12·1 answer
  • The United States is the only country in the world in which organs and tissue transplants are performed. True or False?
    8·1 answer
  • a) Before writing any code, you should go through a design process. Try to do so carefully – either follow a top-down approach,
    15·1 answer
  • ____ occurs when two nodes simultaneously check a channel, determine that it is free, and begin to transmit.
    9·1 answer
  • C program To print odd numbers from 15 to 1 ​
    8·1 answer
  • What does the Python print() function do?
    7·1 answer
  • Write a method named isNumericPalindrome that accepts an integer parameter named num. If num is a palindrome the method must ret
    6·1 answer
  • If you do a Find and Replace for a term, where will Word begin looking for the term?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!