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
A pin fin of uniform cross-sectional area is fabricated of an aluminum alloy (k = 160W m-1 K-1 ). The fin diameter is D = 4 mm,
disa [49]

Answer: (a) 36.18mm

(b) 23.52

Explanation: see attachment

4 0
3 years ago
A renewable item is something that is capable of being replaced naturally.
djverab [1.8K]
The answer is False.
6 0
3 years ago
Read 2 more answers
A plane wall of thickness 0.1 m and thermal conductivity 25 W/m·K having uniform volumetric heat generation of 0.3 MW/m3 is insu
Contact [7]

Answer:

T = 167 ° C

Explanation:

To solve the question we have the following known variables

Type of surface = plane wall ,

Thermal conductivity k = 25.0 W/m·K,  

Thickness L = 0.1 m,

Heat generation rate q' = 0.300 MW/m³,

Heat transfer coefficient hc = 400 W/m² ·K,

Ambient temperature T∞ = 32.0 °C

We are to determine the maximum temperature in the wall

Assumptions for the calculation are as follows

  • Negligible heat loss through the insulation
  • Steady state system
  • One dimensional conduction across the wall

Therefore by the one dimensional conduction equation we have

k\frac{d^{2}T }{dx^{2} } +q'_{G} = \rho c\frac{dT}{dt}

During steady state

\frac{dT}{dt} = 0 which gives k\frac{d^{2}T }{dx^{2} } +q'_{G} = 0

From which we have \frac{d^{2}T }{dx^{2} }  = -\frac{q'_{G}}{k}

Considering the boundary condition at x =0 where there is no heat loss

 \frac{dT}{dt} = 0 also at the other end of the plane wall we have

-k\frac{dT }{dx } = hc (T - T∞) at point x = L

Integrating the equation we have

\frac{dT }{dx }  = \frac{q'_{G}}{k} x+ C_{1} from which C₁ is evaluated from the first boundary condition thus

0 = \frac{q'_{G}}{k} (0)+ C_{1}  from which C₁ = 0

From the second integration we have

T  = -\frac{q'_{G}}{2k} x^{2} + C_{2}

From which we can solve for C₂ by substituting the T and the first derivative into the second boundary condition s follows

-k\frac{q'_{G}L}{k} = h_{c}( -\frac{q'_{G}L^{2} }{k}  + C_{2}-T∞) → C₂ = q'_{G}L(\frac{1}{h_{c} }+ \frac{L}{2k} } )+T∞

T(x) = \frac{q'_{G}}{2k} x^{2} + q'_{G}L(\frac{1}{h_{c} }+ \frac{L}{2k} } )+T∞ and T(x) = T∞ + \frac{q'_{G}}{2k} (L^{2}+(\frac{2kL}{h_{c} }} )-x^{2} )

∴ Tmax → when x = 0 = T∞ + \frac{q'_{G}}{2k} (L^{2}+(\frac{2kL}{h_{c} }} ))

Substituting the values we get

T = 167 ° C

4 0
3 years ago
Do you get a better performance using premier gasoline (Octane number 93) for your compact car?
topjm [15]

Answer:

Yes

Explanation:

As we know that octane number resist the engine from knocking.If knocking can prevent that automatically the performance of engine will increases.If octane number is 100 then it means that knocking tendency in the engine is zero.So higher the octane number better will the performance of the engine.

Generally octane number is 87 but for premier gasoline is 92 or 93.

So we can say that if octane number is  93 then car will give better performance

6 0
3 years ago
Can i eat unhealthy while i’m drinking green tea for weight loss ?
Zina [86]

Answer:I don't think it's a better idea to eat unhealthy food while having green tea because it will act as a strumbling rock in your attempt of getting weight loss.

Explanation:I don't say you have to mark my ans as brainliest but if ypu think it has really helped you plz don't forget to thank me...

6 0
3 years ago
Read 2 more answers
Other questions:
  • The four strokes in a four stroke cycle engine in proper order.
    7·1 answer
  • Unit for trigonometric functions is always "radian". 1. 10 points: Do NOT submit your MATLAB code for this problem (a) Given f(x
    9·1 answer
  • A rectangular open channel is 20 ft wide and has a bed slope of 0.007. Manning's roughness coefficient n is 0.03. It is in unifo
    10·1 answer
  • A Pelton wheel is supplied with water from a lake at an elevation H above the turbine. The penstock that supplies the water to t
    6·1 answer
  • In the long run, if the firm decides to keep output at its initial level, what will it likely do? Stay on SRATC3 but decrease to
    15·1 answer
  • Respond with TRUE if the symbol of the valve shown belows
    5·1 answer
  • 19. A circuit contains four 100 S2 resistors connected in series. If you test the circuit with a digital VOM,
    9·1 answer
  • what i the maximum flow rate of glycerine at 20C in a 10cm diameter pipe that can be assumed to remain laminar
    8·1 answer
  • You set a sensor to transmit the wind speed on top of a mountain. Which of these languages are you most likely to have used?
    10·1 answer
  • (i) what assumptions about the relationship between the inputs and output are inherent in this specification? do scatter plots s
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!