answer.
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
amid [387]
2 years ago
13

Write an expression that will cause the following code to print "I am a teenager" if the value of userAge is less than 20. Zyboo

ks won't let me edit any other line, and UserAge > 20 was marked wrong. It won't accept the ≥ symbol either.

Computers and Technology
1 answer:
VikaD [51]2 years ago
6 0

Answer:

Replace

if userAge > 20

with

userAge > 19

Explanation:

if userAge > 20  checks if age is 21, 22, 23, 24........

The else condition which prints "I am a teenager" checks if age is 20, 19, 18....

Notice that 20 is inclusive of the else condition; this shouldn't be because for userAge to be less than 20, 20 isn't inclusive

To solve this,

Replace if userAge > 20 with userAge > 19

So that, the else

The else condition which prints "I am a teenager" checks if age is 19, 18, 17, 16....

You might be interested in
A Consider the following method definition. The method printAllCharacters is intended to print out every character in str, start
ozzi

Answer:

<em>(c) The method call, which worked correctly before the change, will now cause a run-time error because it attempts to access a character at index 7 in a string whose last element is at index 6.</em>

<em />

Explanation:

Given

printAllCharacters method and printAllCharacters("ABCDEFG");

Required

What happens when  x < str.length() is changed to x <= str.length()

First, we need to understand that str.length()  gets the length of string "ABCDEFG"

There are 7 characters in "ABCDEFG".

So: str.length()  = 7

The first character is at index 0 and the last is at index 6

Next, we need to simplify the loop:

for (int x = 0; x< str.length(); x++) means for (int x = 0; x< 7; x++)

The above loop will iterate from the character at the 0 index to the character at the 6th index

while

for (int x = 0; x<=str.length(); x++) means for (int x = 0; x<=7; x++)

The above loop will iterate from the character at the 0 index to the character at the 7th index

Because there is no character at the 7th index, the loop will return an error

Hence: (c) is correct

7 0
2 years ago
Phillip is a wellness counselor. He has created a newsletter as a service for his clients. He needs to decide upon a method to d
Alexus [3.1K]
The best technology that Philip could use is the Email Newsletters.  <span> Sent on a regular basis, a content-based email newsletter not only helps you stay on top, but also showcases your updates concerning wellness,  C</span>reate a newsletter that will engage your users.  <span>Ensure that each content is educational, informative, and short but clear. </span>
3 0
2 years ago
Which of the following statements is true? Using existing exceptions makes the program less robust. Always create your own excep
hjlf

Answer:

The third option is correct.

Explanation:

The following option is true because it's a derived with that Throwable class. More than that exception type, it is also other category called Error originating through that Throwable class. As any other class, the exception class will also include fields as well as functions. So, the following are the reason that describes the following answer is true according to the exception class.

The other options are not appropriate according to the following scenario.

8 0
2 years ago
Mitchell has noticed that his co-workers are unable to open attachments in the emails he sends. What is one possible reason for
hammer [34]
Maybe it could be the website or the email it self
 <span />
8 0
2 years ago
Charlotte has set up a home maintenance service that operates out of her city. Workers commit to being available for certain hou
Vinvika [58]

Answer:

MAN

Explanation:

3 0
2 years ago
Other questions:
  • Carefully choosing from a set of alternatives to accomplish an objective is known as? A. Independence B. Decision making C. Netw
    9·2 answers
  • HELP ASAP U GET BRAINLIEST
    15·2 answers
  • Consider the following code: x = 17 y = 5 print (x % y) What is output?
    10·1 answer
  • Which word in brackets is most opposite to the word in capitals? PROSCRIBE (allow, stifle, promote, verify)​
    14·2 answers
  • The following checksum formula is widely used by banks and credit card companies to validate legal account numbers: d0 + f(d1) +
    13·1 answer
  • Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invo
    8·1 answer
  • (Java) Which of the following code segments correctly declare a Strings and gives it a value of "fortran".
    12·1 answer
  • A colleague sent you an awesome article about using proper ergonomics while sitting at the computer. You don't have time to read
    11·1 answer
  • Which of the following best describes the protocols used on the Internet?
    12·1 answer
  • Explain the emerging trends in microcomputer technology in relation to size​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!