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
Sergio039 [100]
2 years ago
14

Write a method getIntVal that will get the correct value input as integer numbers from the user. The input will be validated bas

ed on the first two numbers received as parameters. In other words, your program will keep asking for a new number until the number that the user inputs is within the range of the and . The method should show a message asking for the value within the range as:
Computers and Technology
1 answer:
Setler [38]2 years ago
4 0

Answer:

 import java.util.Scanner;

public class Main

{  

   //Create a Scanner object to be able to get input

   public static Scanner input = new Scanner(System.in);

   

public static void main(String[] args) {

    //Ask the user to enter the lowest and highest values

    System.out.print("Enter the lowest: ");

    int lowest = input.nextInt();

    System.out.print("Enter the highest: ");

    int highest = input.nextInt();

   

    //Call the method with parameters, lowest and highest

    getIntVal(lowest, highest);

}

//getIntVal method

public static void getIntVal(int lowest, int highest){

    //Create a while loop

    while(true){

        //Ask the user to enter the number in the range

        System.out.print("Enter a number between " + lowest + " and " + highest + ": ");

        int number = input.nextInt();

       

        //Check if the number is in the range. If it is, stop the loop

        if(number >= lowest && number <= highest)

            break;

        //If the number is in the range,

        //Check if it is smaller than the lowest. If it is, print a warning message telling the lowest value

       

        if(number < lowest)

            System.out.println("You must enter a number that is greater than or equal to " + lowest);

        //Check if it is greater than the highest. If it is, print a warning message telling the highest value

        else if(number > highest)

            System.out.println("You must enter a number that is smaller than or equal to " + highest);

    }

}

}

Explanation:

*The code is in Java.

You may see the explanation as comments in the code

You might be interested in
What options are available for storing backups, physically?
RUDIKE [14]

The options are available for storing backups, physically are:

  • In both on site and off site,, a person can backup data to a given system that is located on-site, or the backups can be sent to any  remote system that is off-site.

<h3>What is a backup?</h3>

This is known to be a device that helps to save information or data temporarily or permanently.

Note that in the above, The options are available for storing backups, physically are:

  • In both on site and off site,, a person can backup data to a given system that is located on-site, or the backups can be sent to any  remote system that is off-site.

Learn more about backups from

brainly.com/question/17355457

#SPJ12

7 0
1 year ago
Which of the following tags contains metadata about the webpage?
Andre45 [30]
I cannot see the options but I am guessing that it is just regular HTML

If that is the case the <meta></meta> tag can be used and should be placed within the <head></head> tag
8 0
3 years ago
Read 2 more answers
_____ is the operation of setting a variable to a value.
Helen [10]

Answer:

Assignment is the operation of a variable to a value

3 0
3 years ago
When conducting research on the internet, what is a starting point for determining how to start the research?
Alex787 [66]
It depends on what you're researching for.
4 0
3 years ago
Bailey wants to add file protection to a document she has created. She wants to restrict users from changing the content she has
jonny [76]
Id say (B) File, Permissions, Restrict Editing, Editing Restrictions, Comments, Start Enforcement, then enter her password

However much you may want your reviewers to make comments and suggest changes in a document, there may be times when you want to restrict them from changing the content you have created. To restrict formatting in a document, you can click restrict formatting in the protect section of the review tab and follow the procedure in the answer above.


8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the opening page of a website called?
    9·2 answers
  • 10.
    13·1 answer
  • How to Print output in JavaScript
    8·1 answer
  • The ____ contains the computer's "brain," the central processing unit (CPU).
    5·2 answers
  • The "instance" relationship shows that something is an object of a ____.
    5·1 answer
  • What is the Kali Linux's kernel?<br><br> Sorry for english, but help me.
    12·1 answer
  • The work day has just started and you receive reports that the inventory management server is not accessible on your company's n
    7·1 answer
  • Rtjfifjjir<br> jhjjbkjkjjgggjhvhjvhf
    9·1 answer
  • What are your thoughts on copyright?<br><br> (Write 2 or more sentences)
    9·2 answers
  • One line of code is missing (marked in
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!