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]
3 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]3 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
The global network that links millions of computers is the
vitfil [10]
Your answer would be C. Internet since we all use the internet everyday to communicate through all over the world. We can currently communicate to the other side of the world with little to no effort now, almost 10 years ago it would of been very difficult.
6 0
3 years ago
Read 2 more answers
Which of the following aspects of a computer is responsible for making sense of input? processing output memory storage
SVEN [57.7K]

Answer:

Processing

Explanation:

The processor of a computer takes inputs runs them through the loaded programs and returns outputs usually to the screen or speakers of the computer.

8 0
3 years ago
Read 2 more answers
A type of storage which holds data on a permanent basis for later use<br><br><br><br> Help please
nikdorinn [45]

Answer:

Permanent storage, also called persistent storage, is any computer data storage device that retains its data when the device is unpowered. A common example of permanent storage is the computer's hard drive or SSD.

Explanation:

4 0
3 years ago
Wesellyoubuy, a consumer electronics company, received consumer complaints about its employees not being able to communicate wit
Salsk061 [2.6K]

Answer:

customer satisfaction

Explanation:

The consumer electronics company started a new training program for the consumer service employees as the company found that the consumer service employees were following the same strategy to address all types of consumer issues due to which they were not able to communicate with consumers properly.

This leads to improvement in service ratings and sales.

In this scenario, the consumer service team improved <u>customer satisfaction</u>

5 0
3 years ago
Special keys that allow you to use the computer to perform specific functions
Pavel [41]

Answer:

Examples are Ctrl, Alt, Fn, Alt Gr, Shift, Caps Lock, Tab, Scroll Lock, Num lock, Esc, Windows Key, Backspace, Enter...

8 0
3 years ago
Other questions:
  • When looking through the documentation for a specific class, you never actually see the source code for that class. Instead, you
    6·1 answer
  • Hit and Slopes Program: A Write a program that can be used by a ski resort to keep track if local snow conditions for one week.
    15·1 answer
  • Barr the Bear has started a business to sell fish to Poe and his fellow penguins. The penguin customers submit many fish orders,
    12·1 answer
  • What types of scientific claims should be verified
    5·1 answer
  • When a person buys something from an app store, the cost of the item is charged to a credit card whose number often is known by
    5·1 answer
  • Which of the following best describes the 7x7 PowerPoint rule
    8·1 answer
  • Advanced Electronics has employees who use a company website to share work. By posting on the website, employees are
    7·1 answer
  • What feature should be used before a document is printed
    8·1 answer
  • Drag the right word to it’s definition
    13·1 answer
  • For this assignment your are to implement the Pet Class described in Programming Exercise 1, starting on page 494 in our textboo
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!