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
Physical Geography of the Middle East
vagabundo [1.1K]

Answer:

Explanation:

He’s wright SS7G5 The student will locate selected features in

Southwestern Asia (Middle East).

a. Locate on a world and regional political-physical map:

Euphrates River, Jordan River, Tigris River, Suez Canal,

Persian Gulf, Strait of Hormuz, Arabian Sea, Red Sea, and

Gaza Strip.

b. Locate on a world and regional political-physical map the

nations of Afghanistan, Iran, Iraq, Israel, Saudi Arabia, and

Turkey

3 0
3 years ago
1. What is the main factor that affects Earth’s average temperature?
user100 [1]

Answer:

1. The Sun is the primary source of energy that influences any planet's temperature, including Earth. The amount of energy received from the Sun is called insolation; the ratio reflected is called the albedo.

2.There are three major ways in which global warming will make changes to regional climate: melting or forming ice, changing the hydrological cycle (of evaporation and precipitation) and changing currents in the oceans and air flows in the atmosphere

3.The warming of Earth is primarily due to accumulation of heat-trapping greenhouse gases, and more than 90 percent of this trapped heat is absorbed by the oceans. As this heat is absorbed, ocean temperatures rise and water expands. This thermal expansion contributes to an increase in global sea level.

4.The main sources of greenhouse gases due to human activity are: burning fossil fuels leading to higher carbon dioxide concentrations. farming and forestry — including land use change via agriculture and livestock. cement manufacture.

5. - Reduce, Reuse, Recycle

- Use Less Heat and Air Conditioning

-Use Less Hot Water

Explanation:

5 0
3 years ago
Which function is going to find the lowest value in a range of numbers? MIN MAXAVERAGE COUNT
never [62]
Min is the correct bicycle
8 0
3 years ago
Whoever helps me with these questions i will help them with the same number of questions in any subject: 1. As the operations ma
mezya [45]
I'm going have to go with with 1.b and 2.d hope this helps and I don't need help right now.
6 0
3 years ago
Which step creates a connection between a file and a program in python?
Mandarinka [93]
<span>The step of opening a file creates a connection between a file and a program.Opening an output file usually creates the file on the disk and allows the program to write data to it.Opening an input file allows the program to read data from the file.</span>
5 0
3 years ago
Other questions:
  • Jane is a postproduction crewmember for a film. Her responsibilities include arranging all the scenes that have been shot into t
    7·1 answer
  • The two types of objects responsible for collecting data are
    14·1 answer
  • "The pkill command terminates _________."
    14·1 answer
  • Switches operate on what layer of the OSI Model
    11·1 answer
  • Which occupation requires certification by the state?
    15·2 answers
  • 120
    14·1 answer
  • Given that add, a function that expects two integer parameters and returns their sum, and given that two variables, euro_sales a
    7·1 answer
  • A chemistry teacher colleague of yours uses video regularly in their courses, but commented to you about how much time it takes
    15·2 answers
  • Which picture should i put as my profile picture.
    15·2 answers
  • The equals method of the Object class returns true only if the two objects being compared:_________
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!