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
drek231 [11]
3 years ago
9

What is the value of the magicPowers variable after executing the following code snippet? String magicPowers = ""; int experienc

eLevel = 9; if (experienceLevel > 10) { magicPowers = magicPowers + "Golden sword "; } if (experienceLevel > 8) { magicPowers = magicPowers + "Shining lantern "; } if (experienceLevel > 2) { magicPowers = magicPowers + "Magic beans "; }

Engineering
1 answer:
Evgen [1.6K]3 years ago
5 0

Answer:

Shining lantern Magic beans                

Explanation:

I will explain the code line by line.

The first statement contains a string type variable magicPowers and second statement has an int type variable experienceLevel which is initialized by value 9.

Nested if statement are used and lets see which of those statements execute.

The first if statement checks if the value of experienceLevel is greater than 10. This statement evaluates to false because the value of experienceLevel is set to 9. Then the program control moves to the next if statement.

The second if statement checks if the value of experienceLevel is greater than 8. This if condition evaluates to true because the value of experienceLevel  is 9. So this if statement is executed which contains the statement magicPowers = magicPowers + "Shining lantern "; . This means magicPowers stores the string Shining lantern.

The third if statement checks if the value of experienceLevel  is greater than 2. As the value of experienceLevel  is 9 so this condition also evaluates to true which means the statement magicPowers = magicPowers + "Magic beans "; is executed. This statement means magicPowers stores the string Magic Beans

You can use a print statement to display the output on the screen as:

System.out.print(magicPowers);

Output:

Shining lantern Magic beans        

The program along with the output is attached as a screenshot.

You might be interested in
If there are 16 signal combinations (states) and a baud rate (number of signals/second) of 8000/second, how many bps could I sen
Mice21 [21]

Answer:

32000 bits/seconds

Explanation:

Given that :

there are 16  signal combinations (states) = 2⁴

bits  n = 4

and a baud rate (number of signals/second) = 8000/second

Therefore; the number of bits per seconds can be calculated as follows:

Number of bits per seconds = bits  n × number of signal per seconds

Number of bits per seconds =  4 × 8000/second

Number of bits per seconds = 32000 bits/seconds

6 0
2 years ago
Select a research proposal topic that relates to electrical and electronics engineering and write a proposal report taking into
fiasKO [112]

Expand your technical knowledge, form global networks and balance life & work commitments. Our advanced diplomas remain current with technological and industry developments.

8 0
3 years ago
QUESTÃO 13. Explique o uso das aspas no trecho "Darei a cada uma de vocês
lesya [120]

Answer: speaks Portuguese

Eu disse a todos a tradução para que possam te ajudar

Explanation: Y’all can help I have no idea

QUESTION 13. Explain the use of quotation marks in the excerpt "I will give each of you

seed. The one who will bring me the most beautiful flower within six months will be chosen but

wife and the future empress of China. ".

QUESTION 14. The palace servant considered the idea of ​​her daughter attending the celeb

organized by the prince of the region, a foolish idea, a madness. This is an OP

Do you agree with this opinion of the character? Justify your answer.

6 0
3 years ago
A 50-kN hydraulic press performs pressing and clamping actions. The clamping cylinder force is 4 kN. The pressing cylinder strok
galben [10]

Answer:

The attached figure shows the hydraulic circuit using one sequence valve to control two simultaneous operations performed in proper sequence in one direction only. In the other direction, both the operations are simultaneous.

When we keep the 4/2 DCV in crossed arrow position, oil under pressure is supplied to the inlet port of the sequence valve. It directly flows to Head end port-1. Hence Cylinder 'C1' extends first.

By the end of the extension of cylinder 'C1', pressure in the line increases and hence poppet of sequence valve is lifted off from its seat and allows oil to flow to port-2 and hence, Cylinder 'C2 extends completing the pressing operation.

In the straight-arrow position of 4/2 DCV the oil under pressure reaches the rod end of both the cylinders C1 and C2 simultaneously through port-3. This causes both the cylinders to retract simultaneously.

Also, a Flow control valve is provided tho control the velocity of clamping

Explanation:

find attached the figure

4 0
3 years ago
For each topic, find the total number of blurts that were analyzed as being related to the topic. Order the result by topic id.
photoshop1234 [79]

Answer:

Explanation: see attachment below

8 0
3 years ago
Other questions:
  • A gear and shaft with nominal diameter of 34 mm are to be assembled with a medium drive fit (H7/s6). The gear has a hub, with an
    9·1 answer
  • A steam power plant operates on an ideal Rankine cycle with two stages of reheat and has a net power output of 120 MW. Steam ent
    14·1 answer
  • A town is designing a rectangular, 4m deep settling tank for treating surface water intake. The tank will have a flow velocity o
    14·1 answer
  • The impeller shaft of a fluid agitator transmits 28 kW at 440 rpm. If the allowable shear stress in the impeller shaft must be l
    6·1 answer
  • Three possible career opportunities in embedded systems engineering
    11·1 answer
  • Consider a potato being baked in an oven that is maintained at a constant temperature. the temperature of the potato is observed
    14·1 answer
  • A 4-pole, 3-phase induction motor operates from a supply whose frequency is 60 Hz. calculate: 1- the speed at which the magnetic
    10·1 answer
  • Which of the following is not caused by alcohol?
    10·2 answers
  • Teaching how to characterize and implement high speed power devices for tomorrow's engineers
    10·1 answer
  • What is the correct procedure for mounting the m240 on the m122a1 tripod after the pintle is attached to the receiver?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!