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
lutik1710 [3]
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 < 20 && num > 30){ System.Out.Println("That's not in the twenties!"); num = 25; } System.Out.Println("Your number is " + num);
Computers and Technology
1 answer:
irakobra [83]3 years ago
8 0

Answer:

Change if(num < 20 && num > 30)

to

if(num < 20 || num > 30)

Explanation:

The code has lots of errors most of which are as a result of case sensitivity of java programming language

The following errors were corrected.

All System.Out.Println were changed to System.out.println

scan.NextInt() was changed to scan.nextInt()

Now to the actual correction that needs to be made;

The programmer's error was in using the conditional statement.

The programmer used if(num < 20 && num > 30) as its condition which means that if num is less tha 20 and at the same time greater than 30

This is impossible because no number is greater than 30 and less than 20 at the same time.

So, the correction made was to change the && (and) to || (or) which means that numbers greater than 30 or less than 20.

<em></em>

<em>This corrects the programmer's mistake</em>

<em>See attachment for complete code</em>

Download txt
You might be interested in
This type of brake fade is caused by the brake fluid becoming so hot that it boils:a. Fluid fade b. Hydraulic fade c. Heat fade
PolarNik [594]
Its is B)hydraulic fade
5 0
3 years ago
Which of the following refers to semitransparent text or a faint object that appears
Agata [3.3K]
<h2>Option D: Watermark refers to semitransparent text or a faint object that appears behind the document content.</h2>

Explanation:

Footer: This is a text which appears in the bottom of every page. Mostly page numbers and the name of the publisher or the company name will be in the footer.

Page Color: This represents the color of the page

Page border: This option provides border to the page. The border can be thin or thick according to the requirement.

Watermark: This is the right answer. A watermark is added such that your content cannot be used by anyone else without permission. When you copy the text, the water mark also gets copied, thus avoiding plagiarism.

4 0
3 years ago
Whereas lines of competition are clearly defined in the more established industries, in the Internet industry they are blurred a
Zarrin [17]

Answer:

Whereas lines of competition are clearly defined in the more established industries, in the Internet industry they are blurred and indistinct, as companies that compete one day may be partners the next. So "Lines" cannot be compared to/with internet companies.

Explanation:

The Internet Industry  is shaped by its unique framework outlining and its own rules between the companies within it, which offer a vast number of products and services and not always competing with each other compared with the traditional established industries competition lines that were developed from two parties or more aiming the same unshareable goal. These industries are stablishing the lines of competitions predicament which by all means can not be measured and applied using the same criteria for both of them.

The online industry is claiming for flexible, pliant lines of competition to be inforced to its specific logic and mechanisms.

The companies are now in a brand new competing ground with the digital area, so traditional established bart lines of competition although clear and defined are becoming obsolete facing the current surprising thus blurred and indistict internet industry lines.

6 0
2 years ago
Which term refers to actions that you would typically perform on a computer to revive it even if it functions in an unexpected m
sweet-ann [11.9K]
You'd usually reboot a PC if it malfunctions.
6 0
2 years ago
. What year did the USA host World Cup? Right answer 1994
Ksivusya [100]

Answer:

USA host World Cup in 1994 1994 FIFA World Cup

Explanation:

USA host World Cup in 1994 FIFA World Cup

it was the 15th edition of FIFA World Cup

and Brazil was won the tournament

Brazil beat Italy by 3–2 in  penalty shoot-out

it was play between 17 June to 17 July and 24 team play this World Cup

and there matches played = 52

and 9 cities host this game

United States of America was chosen as the host by FIFA on the 4 July, 1988

5 0
2 years ago
Other questions:
  • What does the acronym GIF stand for? Graphics Interface Format Graphics Interchange Format Going Into Files Gathering Informatio
    12·2 answers
  • Which of the following would most likely be responsible for configuring firewalls and IDPSs, implementing security software, and
    8·2 answers
  • Please help. 15 points!!!!
    8·2 answers
  • Which institution developed outside the limits of the written costitution of the united states ?
    14·1 answer
  • How all wheel drive works
    5·1 answer
  • Give two advantages of representing integers in pure binary.
    5·1 answer
  • Whats wrong with my code for .addEventListener
    11·1 answer
  • What your favorite video game? (Put your user if you wanna play!)
    9·2 answers
  • Which of the following is the best way to keep up with trends in your industry?
    8·1 answer
  • Need help with a program to search to sort elements in an array.(increasing or decreasing order)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!