subject

The template code provided is intended to check whether an integer entered by the user is outside of the range 20-29 (inclusive). If it is outside of this range the program should print a warning and change the number to 25. However, when using De Morgan's law to simplify this code, the programmer has made some mistakes. Can you correct the errors so the code functions as intended? code:
Scanner scan = new Scanner(System. in);
System. out. println("Enter a number in the twenties");
int num = scan. nextInt();

if(num 30){
System. out. println("That's not in the twenties!");
num = 25;
}
System. out. println("Your number is " + num);
sample run: Enter a number in the twenties
28
Your number is 28

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:00, carriecarl3530
Ineed a good science fair name i’m doing a homemade water filter and i have no idea what the title should be plz
Answers: 1
image
Computers and Technology, 24.06.2019 00:30, Auttyrain3929
Afiling system in which an intermediary source of reference, such as a file card, must be consulted to locate specific files is called a(n) system. a. shelf filing b. direct filing c. indirect filing d. shingling
Answers: 1
image
Computers and Technology, 24.06.2019 13:30, yola32
What is the most important for you to choose before you build a network?
Answers: 1
image
Computers and Technology, 24.06.2019 14:00, Abrahamolve
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
Answers: 1
You know the right answer?
The template code provided is intended to check whether an integer entered by the user is outside of...

Questions in other subjects: