Write a short program that allows the user to input a positive integer and then outputs a randomly generated integer between 1 and the input number.
What will be an ideal response?
```
import java.util.Scanner;
import java.util.Random;
public class RandomInteger {
public static void main(String [] args) {
int inputNum, randNum;
Scanner input = new Scanner(System.in);
Random generator = new Random();
System.out.print("Please enter a positive integer: ");
inputNum = input.nextInt();
randNum = generator.nextInt(inputNum) + 1;
System.out.println("Your random number is " + randNum + ".");
}//end main
}//end class
```
You might also like to view...
What is the default concurrency level of a ResultSet object?
a. public b. updatable c. private d. read-only
Which of the following is true about cluster shared volumes?
A. you use Hyper-V Manager to enable cluster shared volumes B. only empty disks can be CSV-enabled C. once CSVs are enabled, the virtual machine default storage location is a network share D. you can store files in the ClusterStorage directory using Windows explorer
Which Bell-LaPadula rule says a subject cannot read data located at a higher security level than that possessed by the subject?
A. Simple security rule B. *- property rule C. Strong star property rule D. Weak star property rule
Laptop motherboards are similar to desktop motherboards in that they are mobile and hold the majority of their electronics, contain a processor, have memory, and support having ports attached
Indicate whether the statement is true or false