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
Zielflug [23.3K]
3 years ago
9

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
Computers and Technology
1 answer:
Pavlova-9 [17]3 years ago
3 0

import java.util.Scanner;

public class JavaApplication60 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter a number in the twenties");

       int num = scan.nextInt();

   if(num >= 30 || num <= 19){

       System.out.println("That's not in the twenties!");

       num = 25;

   }

   System.out.println("Your number is " + num);

   }

}

This is the complete code including the main class and main method. I hope this helps!

You might be interested in
Write a series of conditional tests. Print a statement describing each test and your prediction for the results of each test. Fo
N76 [4]

Answer:

this:name = 'John'

print("Is name == 'John'? I predict True.")

print(name == 'John')

print("\nIs name == 'Joy'? I predict False.")

print(car == 'Joy')

this:age = '28'

print("Is age == '28'? I predict True.")

print(age == '28')

print("\nIs age == '27'? I predict False.")

print(age == '27')

this:sex = 'Male'

print("Is sex == 'Female'? I predict True.")

print(sex == 'Female')

print("\nIs sex == 'Female'? I predict False.")

print(sex == 'Joy')

this:level = 'College'

print("Is level == 'High School'? I predict True.")

print(level == 'High School')

print("\nIs level == 'College'? I predict False.")

print(age == 'College')

Conditions 1 and 2 test for name and age

Both conditions are true

Hence, true values are returned

Conditions 3 and 4 tests for sex and level

Both conditions are false

Hence, false values are returned.

7 0
3 years ago
Write down the numbering system from base 2 to 200​
natka813 [3]

Answer:

So, 11001000 is the binary equivalent of decimal number 200 (Answer).

 

3 0
4 years ago
What name is used to denote a common field that exists between two tables, but is also the primary key for one of the tables??"
Diano4ka-milaya [45]

Answer:

b. foreign key

Explanation:

In the database world, a foreign key is a field on one table and a primary key for another table. The purpose of a foreign key is to provide linkages between two or more tables. Given two tables A and B, and making A the point of reference, a primary key is a field that is unique in A while a foreign key is unique in B.

On another hand, a composite primary key is a combination of two or more fields/columns on database table that can be used to uniquely identify each row in the table.

In the database lingua, what we have is a unique key not a distinct key, though the two words are similar in meaning.

A duplicate key is used when an information may be repeatedly entered on a table.

So the correct option is a foreign key.

4 0
4 years ago
Which type of books contains snapshots of steps that help to perform an activity?
stellarik [79]

Answer:

online book,,.........,.

5 0
3 years ago
Read 2 more answers
In what year did alienware introduce alienfx lighting zones into their pc's?
ser-zykov [4K]
The answer to the question asked  above is 2006. 
<span>Alienware introduce alienfx lighting zones into their pc's on 2006.</span>

Hope my answer would be a great help for you.    If you have more questions feel free to ask here at Brainly.
8 0
3 years ago
Other questions:
  • What is an independent data mart?
    8·1 answer
  • Web-based application software is software that ________.
    13·1 answer
  • Which of the following is NOT a web browser?<br> Safari<br> Chrome<br> Bing<br> Firefox
    8·2 answers
  • . Given an initially empty stack s that accepts integers, the following operations are performed: s.push (10) s.push (20) s.push
    13·1 answer
  • What does media saturation mean?
    15·1 answer
  • PLEASE HURRY!!!!<br> Look at the image below
    8·1 answer
  • Que es el sistema persona producto?​
    8·1 answer
  • (1) Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a
    10·1 answer
  • This provides an easy method for workers to use their computers. FAT FAT RAM RAM DOS DOS GUI
    12·1 answer
  • Which of the following digital communicatio media does not require a connection to the internet
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!